Learn HTML by Building a Cat Photo App - Step 15

Tell us what’s happening:
Hello! I’am failing do get past the step 15 in the learn HTML by Building a Cat Photo App . Every time I check my code, the hint says that " You should only add one opening anchor (a) tag. Please remove any extras". What I have to do to get past this lesson?

Your code so far

<html>
  <body>
    <main>
      <h1>CatPhotoApp</h1>
      <h2>Cat Photos</h2>
      <!-- TODO: Add link to cat photos -->
      <p>See more <a target="_blank" href="https://freecatphotoapp.com">cat photos</a> in our gallery.</p>

<!-- User Editable Region -->

      <a href="https://freecatphotoapp.com"> <img src="https://cdn.freecodecamp.org/curriculum/cat-photo-app/relaxing-cat.jpg" alt="A cute orange cat lying on its back."</a>

<!-- User Editable Region -->

    </main>
  </body>
</html>

Your browser information:

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

Challenge: Learn HTML by Building a Cat Photo App - Step 15

Link to the challenge:

You haven’t closed off your img element properly.

1 Like

Thank you very much! I’m sorry to have made you answer such a stupid question as mine.

It’s easy to miss stuff. I’ve spent a long time staring at code which refuses to work until I spot some really simple mistake. It’s pretty normal I think!

2 Likes

Hey!
I just discovered the same that by closing the img element makes the code to be executed perfectly, but now I am wondering why in previous steps it was said that img element is a self-closing tag, so isn’t it a bit contradicting?
I hope you understand my question.
Thanks if you are eager to reply.

The difference between self-closing elements and elements which are not self-closing :

<!-- self-closing -->
<img src="url" alt="some text">
<input type="text" id="username">

<!-- not self-closing -->
<h1 class="header">This is a header</h1>
<p class="main-text">Here is some text</p>

Self-closing elements only need a single tag.
Elements which are not self-closing require both an opening and closing tag.

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.