It wants me to turn the >cat photos</p> into a link, but says I only need "<a>" as the only anchor

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

  **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 cat photos.</p>
    *<a href="https://freecatphotoapp.com">cat photos</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) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/102.0.5005.62 Safari/537.36

Challenge: Step 12

Link to the challenge:

Hey there! Welcome to the forums! :wave: :slightly_smiling_face:

Phew, that’s a bit of a title to read. In future posts could you put your details here instead? It makes it easier to read and easier to search. :smile:


Okay a couple things:

<a href="https://freecatphotoapp.com">cat photos</p>
 ^                                                ^
 |                                                |

It doesn’t look like your opening and closing tags match. An anchor tag turns content between it’s opening and closing tags into a link so without a closing tag would be undefined behavior.
I think most browsers would automatically close it when it’s parent element closes, but that’s not something you should rely on.

Second, they want this text turned into a link:

<p>Click here to view more cat photos.</p>
                           ^^^^^^^^^^

Meaning you need to nest your anchor inside the paragraph. You can nest an <a> in a <p> in a similar way to a <p> nested in <main>:

<p> This is a <a href="#"> link</a>!</p>

Which renders as:

This is a link!

1 Like

Lol thank you and im sorry, I’m a newbie trying toget the hang of it.
so this is what I thought it was

<a href="Click here to view more"cat photos.


I’m messing up somewhere in there.

So you see how in my example I close the <a> tag before I write the word “link”?

<a href="#"> link</a>
           ^

That’s the first part you need to do. Second is to add the closing tag, </a> after the content that you want to be a link:

<a href="whatever_url">   content   </a>
^^^^^^^^^^^^^^^^^^^^^^^   ^^^^^^^   ^^^^
      opening tag          \          \
                            \           closing tag
                            text you want as link
1 Like

cat photos

 

Ok here is my try at it

  <p>Click here to view more <a href="cat photos".</a>
<a href="https://freecatphotoapp.com">cat photos</a>

It says that there should only be one a anchor in these subject lines?

It is great that you solved the challenge, but instead of posting your full working solution, it is best to stay focused on answering the original poster’s question(s) and help guide them with hints and suggestions to solve their own issues with the challenge.

We are trying to cut back on the number of spoiler solutions found on the forum and instead focus on helping other campers with their questions and definitely not posting full working solutions.

I had to edit for readability.

<p>Click here to view more <a href="cat photos".</a>
<a href="https://freecatphotoapp.com">cat photos</a>

I am going to break down your code look at

<a href="cat photos".</a>
          ^^^^^^^^

the href isn’t what required from you in the step

<a.</a>
  ^

your opening tag isn’t complete, it requires both < and >

you have two links you don’t need them, you can use one <a> with its closing tag </a>

2 Likes

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