How to create an HTML link on a web page
To create a link on your web page or blog to another page requires an HTML a href tag be inserted into the body section of HTML source code. Below are two examples with additional information of the different types of links you can insert into a page.
Absolute HTML link example
<a href="https://www.computerhope.com/">Computer Hope</a>
In the above example, this link is an absolute path link that points to the Computer Hope homepage as shown below. As long as the Computer Hope web page is up and running and you have an Internet connection you can visit the link with no errors.
With an absolute link, you can link to any URL shown in your Internet address bar. For example, if you wanted to link to this page you could copy the " https://www.computerhope.com/issues/ch001657.htm " address and paste it into the href portion of the link.
Relative HTML link example
If the file "hope.html" did not exist in the same directory as the page trying to link to the page, you would get a 404 error. What makes a relative link unique is that it allows you to link to a page that will work online or offline and that can be copied to any server without any errors.
Additional anchor attributes
The anchor tag also supports other attributes. For example, you could add the title attribute to describe the link as shown in the link below when hovering the mouse pointer over the link. See the link below for additional attributes that can be added to the anchor.
- How to link an image to another page in HTML.
- How to create a link that opens a new web page window or tab.
- How to create links to sections on the same page in HTML.
- How to change the color of links on a web page.
- What is a naked URL?
- See our hyperlink definition for further information and related links.
- HTML help and support.