How Can We Help?
< All Topics


Links are used to connect multiple HTML pages.

A Website is a collection of web pages and these web pages are connected with each other using HTML links. Users can visit one page to another HTML web page by clicking on the links.

More Information About Links:

  • HTML links are also called Hyperlinks.
  • Link can be in the form of text as well as images or other media
  • You can provide a link to any section of the same page, any other page within a website or any external website as well.

HTML Links Syntax

We can create HTML links using the anchor <a> tag.

For example: <a href="<>"> Tutorials Class </a>

The href attribute is used to specify the link address of the web page. The text between the anchor tags “Tutorials Class” is visible to the user. Users can click on this and it will take them to another page.

Example of HTML Link using anchor tag:


<a href="<>" target="_blank">Go to Tutorials Class</a>


Type of Link URLs:

Absolute URLs: These are full addresses to the destination page/link.

Example of Absolute URL is: <a href="<>"> Page 1 Link </a>

Relative URLs: A relative URL links to a file in relation to the present directory.

For example, if you want to create a link from “page1.html” to “page2.html” and both files are in the same folder, you can simply provide the file name in href. It is called the relative URL.

Example of Relative URL: <a href="page2.html"> Page 2 Link </a>

HTML Links Target:

We can set HTML Links Target to open into the new window or the same window. The target attribute is used with one of the following values:

Example of HTML Target Attribute: <a href="page2.html" target="_top"> Link with New Window </a>

HTML Target Attribute Values List

Target Value Purpose
_blank It opens the linked page in a new window or tab
_self It opens the linked page in the same window/tab in which we clicked on the link. (This is the default link target)
_parent It opens the linked page in the parent frame
_top It opens the linked page in the full body of the window
framename It opens the linked page in a named frame

Complete Example of HTML Links

Let us create two files “page1.html” & “page2.html”. We will create a link between these two files using a relative URL. We will also test a link using an absolute url as well.

Create an HTML file “page1.html” and write the following code:


<a href="page2.html" >Example of Relative Link</a>

<a href="<>" target="_blank">Example of Absolute Link</a>


Create an HTML file “page2.html” and write the following code:


<a href="page1.html">Example of Relative Link</a>

<a href="<>" target="_blank">Example of Absolute Link</a>

Table of Contents