Example

A simple <a> tag that open PNLdev.com link:

Laboratory

description & Usage

You can link from one HTML page to other pages of the same site (or other sites) with the <a> tag.

The following two terms are usually used to call the <a> tag:

  • link
  • Hyperlink

The most important features of the <a> tag are href and target:

  1. href: specifies the destination of the link.
  2. target: specifies that the target should be opened in a new browser tab or on the same page.

The <a> tag is an abbreviation of the word anchor.

Notes

Note: If the attribute is not in the <a> tag, this tag only keeps the anchor text and is not linked.

<a>anchor text</a>

Note: If the attribute in the <a> tag is empty, the link will be given to the page itself.

<a href="">anchor text</a>

Browser compatibility and Support

# Chrome Edge Firefox Safari Opera
<a>

Attributes

Attributes Values Description
download
filename
By clicking the link, the download will begin.
href
URL
It specifies the address of the destination page(website).
hreflang
language_code
It specifies the language of the destination page(website).
media
media_query
It specifies destination page(website) is optimized for which device and media
ping
list_of_URLs
It is for tracking the user. When the user clicks on the link, a POST request is sent to the ping addresses inside it.
referrerpolicy
no-referrer
no-referrer-when-downgrade
origin
origin-when-cross-origin
same-origin
strict-origin-when-cross-origin
unsafe-url
It specifies the information that is sent when the link is clicked from the referrer (the current page or website) to the destination page.
rel
alternate
author
bookmark
external
help
license
next
nofollow
noreferrer
noopener
prev
search
tag
It specifies the relationship between the current page and the destination page.
target
_blank
_parent
_self
_top
It specifies where to open the link, in new page(tab) or current page(tab)
type
media_type
It specifies the type of media for the destination address. For example: JPG, MP4, HTML, etc.

Global Attributes

The <a> tag supports the HTML Global Attributes.

Event Attributes

The <a> tag supports the HTML Event Attributes.

Default CSS

Most browsers will display the <a> tag with the following default style: