Learn HTML by Building a Cat Photo App - Step 14

I have been told to add a target to my HTML code:

“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.” That was the question but I did not understand

My code below

<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>

OK…thus far you have a p element and then, nested inside of that, you have an anchor element. Now, in your anchor element you have added an attribute and a value. So the href is the attribute, and the url is the value for the attribute.

So what you’re going to do now is add a second attribute into that same anchor element. That second attribute will be a target attribute, and its value will be the value of " _blank".

This new attribute will cause the anchor (or link) to open up in a new tab. Make sense?

Yes, it makes sense…Thanks for the help mate :facepunch:t4:

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