Learn HTML by Building a Cat Photo App - Step 15

Tell us what’s happening:
Describe your issue in detail here.

Here again Im struggling with the code…where am I supposed to put the a href code “within” the img code? The hint keep shows me " Your anchor (a ) element should have an opening tag. Opening tags have this syntax: <elementName> ." but I don’t get it…Could anyone help please?

Your code so far

<html>
  <body>
    <h1>CatPhotoApp</h1>
    <main>
      <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."<a href="https://freecatphotoapp.com">cat photos</a>
    </main>
  </body>
</html>

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/105.0.0.0 Safari/537.36

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

Link to the challenge:

having same problem oof

You have to wrap the whole <img> element with an <a> tag.

Your mistake was adding the <a> in the <img> tag with the link text cat photos.

Hey there!

The a tag is used to link webpages together. so for example if you have a webpage which when you click it, takes you to google.com You can do something like this:

//    destination-link        link text
             |                    |
<a href="https://google.com"> a link to google </a>

even though the user will only see the text a link to google and when someone clicks it, the user will be taken to the google’s website.

Here in the same way, you need to a link to https://freecatphotoapp.com with the text “cat photos” in this challenge.
Hope this helps! :smile:

Thanks for your support ties! I don’t really get your comment though, you mean that I should add in front of code?

I have tried to add a href with the link as belows but it still does not work…Im so stucked :frowning:
<img src=“https://cdn.freecodecamp.org/curriculum/cat-photo-app/relaxing-cat.jpg” alt=“A cute orange cat lying on its back.” cat photos

In this challenge you have to make the image clickable, not the text.
The way you would do this, is by surrounding the <img> tag with the <a> tag.

What you need do is to surround the image element with the " a" opening and closing anchor element and make use the hint given.

As I said above it doesn’t really matter what kind of content it is, You can turn them into a link if you just add that content inside of an anchor tag like this: <a> your contennt </a> So just use this idea to turn your image into a link. You can do this :smile:

Your “img” element should be between an “a” element(his opening and closing tag).

I finally figured out, thanks so much! (I literally put in a wrong position…)

Thanks a lot, I got it right now :slight_smile:

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