HTML Text Links

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.


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 –
  • Relative URLs- It refers the target location’s path relative to current location. Example – if we are at and want to navigate to then we just specify it by “/php”.
  • Root Relative URLs- It refers path relative to the domain’s root.

Link Target (target)

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.