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’m trying to understand what a target attribute is, how to use it, and how to install it with instructions given. Any help would be greatly appreciated.
**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">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/101.0.4951.67 Safari/537.36
Hey there!
So first off, target is an attribute not an element. An element is a… like an object within the HTML. An attribute is something that modifies and helps define something about that object.
Now the target attribute decides were to open the link that the anchor tag you clicked is pointing to. If you click the link, were does it open in your browser? And _blank tells it to open it in a new tab.
You can add just like any other attribute in an element. It sits inside the elements opening tag:
Following this example now you only have to understand the difference of elements and attributes. Where element put your anchor <a>. The href in your code is an attribute. Meaning it modifies your element which is the anchor. And as we see it;s included in the opening tag.
All in all that’s something fundemental to understand. Hope it helps.
hmm. Looks like you’ve got an extra “a” between attributes (don’t need that, you only need the first “a”) and you used href2 instead of target. Though it looks like you’ve got the right idea.
In your anchor tag:
Remove this a
\
<a href="https://freecatphotoapp.com" a href2="_blank">
/
change this to (target)
Once you get the basic flow down it gets pretty easy. Just remember how an element tag is formed. It name, and then each of its attributes separated by a space: