Learn HTML by Building a Cat Photo App - Step 14

Add a target attribute with the value _blank to the anchor (a ) element’s opening tag, so that the link opens in a new tab.

<html>
  <body>
    <main>
      <h1>CatPhotoApp</h1>
      <h2>Cat Photos</h2>
      <!-- TODO: Add link to cat photos -->
      <p>Click here to view more <!-- TODO:_blank--> <a 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) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/106.0.0.0 Safari/537.36

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

Link to the challenge:

please restart this step (you have added code that was not requested by this exercise).
After you restart, add the new target attribute to the anchor tag.
(it should be very similar to how the href attribute looks)

We can read the instructions ourselves, so doesn’t really help us help you. It helps more if you talk to us about how the instructions are confusing you.

Talking about code takes practice to get good at.

How to add a target attribute with the value _blank to the anchor (a ) element’s opening tag, so that the link opens in a new tab. I am stuck on this lesson.

Look at the href attribute. The target attribute is exactly the same but it is called target and has a different value.

Ok well I am trying to figure out what is the target attribute and _blank to the anchor meaning.

Do I add another anchor and put in the word Target_blank. I am confused.

No don’t add another element. Just put your mouse inside the anchor opening tag (where the href is) and add the target there. (Just like href but called target).

This is a src attribute.

This is an alt attribute.

This is a href attribute.

You need a target attribute.

Would targe attribute would be Open a new tab? Also, what is the _blank value? This is where I got stuck.

1 Like

Oh so what would be the _blank value?

I got it thanks. :clap:t6: :clap:t6: :clap:t6:

When someone asks you to add an href attribute, what do you do?

You go to the anchor tag and write

href=“value”

And the value here is the website link right?

Target is an attribute just like href.

So just type the word target next to the href and then put the equal sign then open double quotes and put the value _blank in there.

2 Likes

How to put links in a image?

If you have a question about a new step, it is best to use the Ask for Help button again

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