HTML Text Links

In this tutorial you will learn about the HTML Text Links and its application with practical example.

HTML Text Links are formally know as hyperlinks or link. Link allows visitors to navigate the website from one page to another page.

A link is created using <a href=””> tag known as anchor tag and value of href attribute is the URL or PATH where the link is pointing to.

Syntax:

Anchor Attributes

Hypertext references ( href )

This attribute specifies the target url for the linked element. A target can be absolute, relative or root relative URLs.

  • Absolute URLs – It refers the full path for the target location. Example – https://www.w3adda.com
  • Relative URLs- It refers the target location’s path relative to current location. Example – if we are at https://www.w3adda.com/ and want to navigate to https://www.w3adda.com/php then we just specify it by “/php”.
  • Root Relative URLs- It refers path relative to the domain’s root.

It specifies where to open the selected link.

  • _blank – It opens new page in new window to display the target location.
  • _self – It opens new page in the current window to display the target location.
  • _parent – It opens new page into a parent frame.
  • _top – It opens new page into the current browser window, cancelling all frames.

Base href

It is not always required you to complete URL for every link but we can specify a default URL for all links on the page.This can be achieved by putting base tag in the HTML document’s <head> section.

Example:

 

In this tutorial we have learn about the HTML Text Links and its application with practical example. I hope you will like this tutorial.