How to create an HTML link on a web page

Updated 6/30/2019 from

To create a link to another page on your website or blog, an href tag must be included in the “body” section of the HTML source code. Below are two examples with additional information about the different types of links you can place on a page.

Example of an absolute HTML link

computer hope

In the example above, this link is an absolute path link pointing to Computer Hope’s home page, as shown below. As long as the Computer Hope website is active and you have an internet connection, you can access the link without errors.



With an absolute link, you can link to any URL listed in your Internet address bar. For example, if you want to link to this page, you can copy and paste the address “” into the href part of the link.

Example of a relative HTML link

In the example below, this link is a relative path link. It points to a file in the same directory as the page containing the link.

An HTML tag

If the “hope.html” file doesn’t exist in the same directory as the page trying to link to the page, you’ll get a 404 error. What makes a relative link unique is that you can use it to link to a page that works both online and offline.

  How to get rid of a facebook page

Additional anchor attributes

The anchor tag also supports other attributes. For example, you can add the title attribute to describe the link as shown in the link below when you hover over the link. See the link below for more attributes that can be added to the anchor.