I wanted 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 in the above sample but I couldn’t get it. please enlighten me.
Thanks Your code so far
<html>
<body>
<main>
<h1>CatPhotoApp</h1>
<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/107.0.0.0 Safari/537.36
Challenge: Learn HTML by Building a Cat Photo App - Step 14
first click the reset button as I see you have made changes to the anchor text.
After that, simply place your mouse next to the word href and type the word
target
then type an equal sign
then type “_blank”
(you may need to type a space after that to keep things neat).
That’s it.
Reset the code.
Then put your mouse next to the href (on the left, not the right)
then write
target
then write an equal sign
then write the word
“_blank” in double quotes
This is the exact same way you created the href and src.
I’ve edited your code for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.
You can also use the “preformatted text” tool in the editor (</>) to add backticks around text.