The anchor element in HTML part3


 Nest anchor element within a paragraph:

  • Using the anchor element you can nest the links with other text elements.

<p>
  Here's a <a target="_blank" href="https://www.freecodecamp.org"> link to www.freecodecamp.org</a> for you to follow.
</p>


  • Let's break down the example. The example contains two parts:
  • Let's look from the inner element, i.e., the inner anchor element that is started from the:

            <a> ... </a>


  • This anchor element is wrapped in the paragraph element with some plain text added to it that gives it a more explained view to the end user.

            <p> Here's a ... for you to follow. </p>


  • Target is an anchor attribute that specifies where to open the link that is linked to the particular web page.
  • The value _blank specifies to open the link in the new tab.
  • The href is an attribute tag that contains the URL address of the link:

<a href="https://www.freecodecamp.org" target="_blank"> ... </a>


  • The text, link to www.freecodecamp.org within the anchor element is called anchor text, and will display the link to click:

<a href=" ... " target="...">link to freecodecamp.org</a>


No comments:

Post a Comment