The <a> Tag in HTML
The <a> tag, also known as the anchor tag, is an essential element in HTML used to create hyperlinks.
|
| How to use the anchor tag in HTML |
Syntax of the <a> Tag
<a href="URL">Clickable Text</a>
Attributes of the <a> Tag
-
href (Hyperlink Reference):
Specifies the destination URL.
Example:
Output: Visit Example<a href="https://geekscodes.com">Visit Example</a> -
target:
Defines how the link opens:
_self: Opens in the same tab (default)._blank: Opens in a new tab.
Output: Open in New Tab<a href="https://geekscodes.com" target="_blank">Open in New Tab</a> -
rel:
Provides the relationship between the current and linked pages.
Common values:nofollow: Tells search engines not to pass link equity.noopener: Prevents the new page from accessing thewindow.openerproperty.
Output: Safe Link<a href="https://geekscodes.com" rel="nofollow noopener">Safe Link</a> -
title:
Adds extra information about the link, visible as a tooltip on hover.
Example:
Output: Visit Example<a href="https://geekscodes.com" title="Go to Example">Visit Example</a>
