Home » Learn » HTML

Creating Hyperlinks (Part 5)

 · 3 min · Nasir

Part 5 of the introduction to HTML: Creating Hyperlinks

Learn HTML

Hyperlinks, or “links,” are an essential part of the web. They allow users to navigate from one webpage to another by clicking on a specific piece of text or an image. Creating hyperlinks in HTML is a simple process that requires the use of the <a> element.

To create a hyperlink in HTML, you need to use the <a> element and the href attribute. The href attribute specifies the destination of the link. Here is an example of how to create a hyperlink in HTML:

<a href="https://www.heksagon.net">Click here to visit heksagon.net</a>

The text “Click here to visit heksagon.net” will be displayed on the webpage, and when clicked, it will take the user to the webpage at “https://www.heksagon.net”.

You can also use the <a> element to create a link to a specific location on the same webpage, or to a location on a different webpage. To link to a specific location on the same webpage, you can use the id attribute and the # symbol. For example:

<a href="#section2">Jump to Section 2</a>

This will create a link that, when clicked, will take the user to the element with an id of “section2” on the same webpage.

To link to a specific location on a different webpage, you can use the full URL of the destination webpage followed by the # symbol and the id of the destination element. For example:

<a href="https://www.example.com#section2">Jump to Section 2 on example.com</a>

Best Practices

Here are some best practices for creating HTML hyperlinks:

  • Use descriptive link text: The text of the link should clearly describe the content that the link leads to. This helps users understand the purpose of the link and improves the overall user experience.

  • Use the title attribute: The title attribute allows you to add additional information to the link, such as a brief description or the purpose of the link. This information is displayed as a tooltip when the user hovers over the link.

  • Avoid using “click here” as link text: “Click here” as link text does not provide any information about the destination of the link and can be confusing for users. Instead, use descriptive link text that accurately reflects the content that the link leads to.

  • Use absolute URLs: An absolute URL includes the full web address of the destination webpage, including the protocol (e.g., “https://"). This ensures that the link will work properly regardless of the location of the webpage that the link is on.

  • Test the link: Before publishing a webpage with a new link, be sure to test the link to make sure it is working properly and takes the user to the correct destination.


Creating hyperlinks in HTML is a simple and powerful way to allow users to navigate the web and access the information they need. By following these best practices, you can create HTML hyperlinks that are clear, informative, and easy to use for users.

We use cookies to improve your experience on our site and to show you relevant advertising.

Read cookie policy

Accept & Close