HTML5 Hyperlinks
HTML
What is a Hyperlink?
A hyperlink (or simply "link") allows users to click and navigate from one page to another, to another location on the same page, or to resources like images, PDFs, downloads, etc.
Hyperlinks in HTML are created using the <a>
(anchor) tag.
<a href="URL">Link Text</a>
<a>
: The anchor element that creates the hyperlink.href
: The attribute that specifies the destination URL.
When clicked, it will take the user to Visit Google.
Types of Hyperlinks
1. Absolute URL
Links to an external website.
2. Relative URL
Links to another page within the same website.
3. Link to an Email
Using mailto:
to open the default mail client.
4. Link to a Phone Number
Using tel:
to start a call on mobile devices.
5. Link to a Section on the Same Page (Anchor)
Attributes of <a>
Attribute | Description |
---|---|
href | URL to navigate to |
target | Defines where to open the link (_blank for new tab, _self for same tab) |
title | Tooltip text when you hover over the link |
download | Tells browser to download the linked file instead of navigating to it |