Learn HTML by Building a Cat Photo App - Step 15

A bit stuck on this part of the code, asking to add an anchor to make the img itself a link. not sure where the anchor goes!

Your code so far

<html>
  <body>
    <main>
      <h1>CatPhotoApp</h1>
      <h2>Cat Photos</h2>
      <!-- TODO: Add link to cat photos -->
      <p>Click here to view more <a target="_blank" href="https://freecatphotoapp.com">cat photos</a>.</p>
    <img src="https://cdn.freecodecamp.org/curriculum/cat-photo-app/relaxing-cat.jpg" alt="A cute orange cat lying on its back.">
    </main>
  </body>
</html>

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:107.0) Gecko/20100101 Firefox/107.0

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

Link to the challenge:

To make an img element into a link, just add the anchor opening tag to the left of the img and the anchor closing tag to the right side

Turn the image into a link by surrounding it with necessary element tags. Use https://freecatphotoapp.com as the anchor’s href attribute value.

everytime i put the anchor elements before and after it says i may have deleted the img?

What does your code look like when you try that?

You should make zero changes to the img element itself. It must stay completely unchanged, down to the last character.

Turn the image into a link by surrounding it with necessary element tags. Use https://freecatphotoapp.com as the anchor’s href attribute value.

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

it wants me to turn that line of code “the picture” to a link

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

That still has no anchor element. You said

What does your code look like with the anchor element.

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

i had wrote it like this but i know that cant be

This isn’t a valid opening anchor tag. Look at the line above:

You have a valid opening anchor tag here.

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

hmm not posting my full code for some reason lol now its acrually linking it lol

This one is close, but its missing the closing anchor tag.

does the closing tag go at the end of the whole line of the code or before the “img” part

ahhh yes i got it!!! thank you so mucH!

1 Like