How to Hyperlink HTML
Here's five examples of how to hyperlink HTML documents. To create a hyperlink, copy the desired HTML code and paste it into your HTML documents.
The regular Hyperlink
This is the bare-bones basic hyperlink.
HTML code
Absolute path example:
<a href="https://example.com/">Some Text</a>
Relative path example:
<a href="/some-file.html">Some Text</a>
Result: Link Text
Hyperlink code with the Link Title Attribute
Used to provide additional information about the link when a user hovers over the link. Best practice is not to provide information that the reader already knows about.
HTML code
<a href="https://example.com/" title="This is a link to my home page.">Link Text</a>
Result: Link Text
Open Link in new tab
This HTML will open link in new tab. When browsers didn't have tabs, this used to open the link in a new browser window.
Attributes
For security reasons, when using the target
attribute with the value of _blank
, it is considered best practice to include the rel
attribute with the value set to noopener
as seen below.
HTML code
<a href="https://example.com/" rel="noopener" target="_blank">Link Text</a>
Result: Link Text
Hyperlink with Link Title and New Tab
All of the above attributes together in one hyperlink.
HTML code
<a href="https://example.com/" target="_blank" rel="noopener" title="This is a link to my home page.">Link Text</a>
Result: Link Text
Notes
- Replace
https://example.com/
with your actual URL. - Replace
Link Text
with your desired link text. - Note: For demonstration purposes, the Result links only link to this page.
More
- Free Coming Soon website template.
- Free website template for small business.
- Free Link in Bio template 4.
- Best free HTML editor for Mac.