Turning an image into a link

I am trying to turn the image into a link surrounding it with necessary element tags. Use https://freecatphotoapp.com as the anchor’s href attribute value.

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

<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 -->

      <img src <a target= "_blank" href="https://cdn.freecodecamp.org/curriculum/cat-photo-app/relaxing-cat.jpg"> <a target= "_blank" href="https://freecatphotoapp.com">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/117.0.0.0 Safari/537.36 Edg/117.0.2045.31

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

Link to the challenge:

1 Like

You should have this in your code at the start
<img src="https://cdn.freecodecamp.org/curriculum/cat-photo-app/relaxing-cat.jpg" alt="A cute orange cat lying on its back.">

From there you can just surround the whole code with the <a></a> element.

2 Likes

Thank you for your response. This is what code looks like after I have surrounded the whole code…

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

1 Like

Hello.

You must use an structure like this example:

<a href="https://www.somelink.com"><img src="someimage.jpg"></a>

Review the example and adjust your code.

Grets.

1 Like

Thank you! I will try this now :grinning:

1 Like

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