Stuck on creating a link step 12

Step 12

Turn the words cat photos located inside p element into a link using the same value for the href attribute as the link below the p element. The p element should show the same text in the browser, but the words cat photos should now be a link. Make sure to remove the a element with the text cat photos on the line below the p element.

  **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 href="cat photos"></p>
    <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.">
  </main>
</body>
</html>
  **Your browser information:**

User Agent is: Mozilla/5.0 (X11; CrOS x86_64 12239.92.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.136 Safari/537.36

Challenge: Step 12

Link to the challenge:

1 Like

Your anchor element’s href attribute should have the uniform resource locator text. You’ve placed the text “cat photos” at the wrong location.

1 Like

No clue how to fix that, can you show me what you mean? I dont see how to make the text clickable, I want to nest somehting but dont know what or how.

1 Like

By placing the text between the opening and closing tags of the anchor element it will become the link (“clickable text”).

Nesting means that one element is within other elements opening and closing tag.

<!-- Opening anchor tag -->
<a href="#" target="#">
<!-- Closing anchor tag -->
</a>

<!-- Nesting example -->
<p>
<a href="#" taget="#">
</a>
</p>

Hi @jasjr939

<p>
This is text, <a>this is text inside a p element and is also a link</a>
</p>
<p>
This is another text, <img  src="workplace.jpg" alt="Workplace">the image before is also a link</a>. I hope this examples will help you to understand the anchor element syntax.
</p>

The p element is a block element (it sits in a new line, because it takes all the available space, from left to right)
and the anchor, a, element is an inline element (like a word or a white space, it sits side by side with other words and inline elements, and only takes the space that its content needs).
References:

Happy coding! :muscle: :sunglasses: :hugs: