Home Videos Exercises MCQ Q&A Quiz E-Store Services Blog Sign in Appointment Payment

HTML Links

Links are found in nearly all web pages. Links allow users to click their way from page to page.


HTML Links

  • HTML links are hyperlinks.
  • You can click on a link and jump to another document.
  • When you move the mouse over a link, the mouse arrow will turn into a little hand.

The basic syntax for creating an HTML link is:

<a href="URL">Link Text</a>


Breakdown:

  • <a>: This is the anchor tag used to define a hyperlink.
  • href: This attribute specifies the URL of the page the link goes to.
  • Link Text: This is the text that will appear on the webpage and will be clickable.

Example

<a href="https://www.soopropathshala.com">Visit Pathshala</a>


Opening Links in a New Tab

If you want the link to open in a new tab, you can add the target="_blank" attribute:


Target attributes

The target attribute specifies where to open the linked document.


The target attribute can have one of the following values:

  • _self - Default. Opens the document in the same window/tab as it was clicked
  • _blank - Opens the document in a new window or tab
  • _parent - Opens the document in the parent frame
  • _top - Opens the document in the full body of the window

Other attributes for <a>:

  • target="_blank": Opens the link in a new tab.
  • rel="noopener noreferrer": Enhances security when opening a link in a new tab, especially with external links.

Here are the key points for HTML links:

  • The HTML element used to create a link.
  • href attribute Specifies the URL of the page or resource the link will open.
  • The link text shows the clickable text that appears in the browser.
  • Use target="_blank" to open the link in a new browser tab.
  • Creates a link that opens the user's email client.