HTML <a> Tag


The HTML <a> element specifies a link to a URL or a destination within the HTML content. The <a> element defines a hyperlink, which is used to connect two pages.

The href property, which identifies the destination of the link, is the most significant attribute of the <a> element.

In all browser, links will display as follows by default:

  • An unvisited link is highlighted in blue.
  • A visited link is highlighted in purple.
  • An active link is displayed in red.

Syntax

Example

Preview

Attributes

Attribute Value Description
download filename When a user clicks on the hyperlink, the target will be downloaded.
href URL Specifies the URL of the page whereby the link leads.
hreflang language-code The language of the referenced document is specified.
media media-query Specifies the media/device for which the referenced document is optimized.
ping list-of-URLs The HTML ping Attribute is often used to define a specific URL or a collection of URLs that will be informed when the user clicks on the hyperlink supplied in the HTML href Attribute.
referrerpolicy no-referrer   
no-referrer-when-downgrade   
origin   
origin-when-cross-origin   
same-origin   
strict-origin-when-cross-origin   
unsafe-url
Specifies which referrer information should be sent along with the link.
rel alternate   
author   
bookmark   
external   
help   
license   
next   
nofollow   
noreferrer   
noopener   
prev   
search   
tag
Describes the connection between the current and related documents.
target _blank   
_parent   
_self   
_top
Specifies where the referenced document should be opened.
type media-type The media type of the referenced document is specified.

Supported Browsers

Element Chrome Firefox Safari Edge / IE Opera
<a> Yes Yes Yes Yes Yes