What is the <a>
Tag?
The <a>
tag (also known as the anchor tag) is used to create hyperlinks in HTML.
How to insert links in HTML?
<a href=”URL”>Link Text</a>
href
= Hypertext REFerence, the destination you’re linking to"Link Text"
= what the user will click on
Attributes of the <a>
Tag:
Attribute | Description |
---|---|
href |
The link destination |
target="_blank" |
Opens the link in a new tab |
title |
Shows text on hover |
download |
Downloads the file instead of opening it |
rel="noopener noreferrer" |
Improves security when opening in a new tab |
Example With All Features:
<a href=”https://example.com” target=”_blank” title=”Go to Example Site” rel=”noopener noreferrer”>Visit Example Site</a>