<a> element not working

Tell us what’s happening:
I see no problem and i am not able to recognize what’s the problem. Please help me find the problem.

Your code so far


<h2>CatPhotoApp</h2>
<main>

<a href="https://freecodecamp.org">this links to freecodecamp.org</a>
<a href="https://freecatphotoapp.com">cat photos</a>
<img src="https://bit.ly/fcc-relaxing-cat" alt="A cute orange cat lying on its back.">

<p>Kitty ipsum dolor sit amet, shed everywhere shed everywhere stretching attack your ankles chase the red dot, hairball run catnip eat the grass sniff.</p>
<p>Purr jump eat the grass rip the couch scratched sunbathe, shed everywhere rip the couch sleep in the sink fluffy fur catnip scratched.</p>
</main>

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36 OPR/72.0.3815.459.

Challenge: Link to External Pages with Anchor Elements

Link to the challenge:

first thing first, you need to have only one a element, after that it will give the test results for the element

Not sure this is the problem but you are missing the img closing tag

@GMFuster, there is no such thing as an “img closing tag”. It’s self closing.

The response by ieahleen is correct

It should not have the / at the end? That is what I got when I tried it and when I added it it seemed to work. Don’t self closing tags also need the /?

Hi @GMFuster!

According to documentation it should be a self closing tag.

Yes, it will still technically work if you have the forward slash but the correct way is how it is in documentation.

However, the img tag wasn’t the issue. The OP added two anchor tags when the lesson only called for one.

Hope that helps!

1 Like

Cool thanks! I always add the / at the end. I guess the editor gave it as an error because it didn’t check the type of tag :slight_smile:

1 Like
<h2>CatPhotoApp</h2>

<main>

<a href="https://freecatphotoapp.com">cat photos</a>

  <img src="https://bit.ly/fcc-relaxing-cat" alt="A cute orange cat lying on its back.">

</img>

  <p>Kitty ipsum dolor sit amet, shed everywhere shed everywhere stretching attack your ankles chase the red dot, hairball run catnip eat the grass sniff.</p>

  <p>Purr jump eat the grass rip the couch scratched sunbathe, shed everywhere rip the couch sleep in the sink fluffy fur catnip scratched.</p>

</main>

I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.

You can also use the “preformatted text” tool in the editor (</>) to add backticks around text.

See this post to find the backtick on your keyboard.
Note: Backticks (`) are not single quotes (’).


It is great that you solved the challenge, but instead of posting your full working solution, it is best to stay focused on answering the original poster’s question(s) and help guide them with hints and suggestions to solve their own issues with the challenge.

We are trying to cut back on the number of spoiler solutions found on the forum and instead focus on helping other campers with their questions and definitely not posting full working solutions.

You can post solutions that invite discussion (like asking how the solution works, or asking about certain parts of the solution). But please don’t just post your solution for the sake of sharing it.
If you post a full passing solution to a challenge and have questions about it, please surround it with [spoiler] and [/spoiler] tags on the line above and below your solution code.