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

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 <a href="https://freecatphotoapp.com_blank">  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/99.0.4844.74 Safari/537.36 Edg/99.0.1150.46

Challenge: Step 13

Link to the challenge:

you should give the target attribute in <a> with value “_blank”

I am having same troubles, So i must start a new line to do so? For example

_Blank

?

<a href="something.com" target="blank">text</a>
3 Likes

Hey, i just tried this. it still says invalid. How is it possible to add the target="">text to it? do i create another line ? thanks for attempting to help as well

This is the current code so far…

Click here to view more cat photos.

i am being told to add a target attribute with the value. The attribute is opening tags similar to href correct and value is what is between the “” ?

I have added the target and the value to the code but still happen to get a error for example here is some of the codes when i write the target attrtribute and it still show as wrong…

Click here to view more cat photos.

<a target="_Blank"
  1. Click here to view more <a href="https://freecatphotoapp.com" target ="_Blank".

Thanks again in advance for the help

no you don’t have to create on separate line, can you post your code

Yes sure, this is my code

Click here to view more cat photos.

Edit** sorry when i paste code, it lead you to the site. how do i get you the code?

before typing click on </> to format your code in the editor

you will find </> button in the editor toolbar

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

I am confused as to where do i input the target attribute if there is already a href tag there. Also, with >cat photos as seen in code, do i remove this and input the value of _blank? they’re both values correct ?

It worked haha, thank you. are you able to see code on your end?

yes that great you learned another thing

1 Like

your anchor tag has no target attribute with value of _blank

1 Like
<a href="...." target="_blank">text in blue</a>
1 Like

Ahhh, i see… so for example…

<a href="something.com">"xxx" target="_Blank">"xxx"</a>

will this work? what is the “text in blue” considered, the value? i can’t add mutliple of those after each alt?

actually a tag can have multiple attributes each separated by a space within < and >

<a href="something.com">"xxx"< and > target="_Blank">"xxx"</a>

Like this?

you have to use > only after you have assigned all the attributes, you can see you have assigned target outside of < and > of anchor which is a syntax error

is it possible you can label tag, attribute and value to get a better understand of them.

For example… will href be consider a alt?