HTML A Tag | HTML <a> Tag |

HTML A Tag


Definition and Usage

The tag defines a hyperlink, which is used to link from one page to another.

 

The most important attribute of the element is the href attribute, which indicates the link's destination.

 

By default, links will appear as follows in all browsers:

  • An unvisited link is underlined and blue
  • A visited link is underlined and purple
  • An active link is underlined and red

 

 

In HTML 4.01, the tag could be either a hyperlink or an anchor. In HTML5, the tag is always a hyperlink, but if it has no href attribute, it is only a placeholder for a hyperlink.

 

 

Attributes

= New in HTML5.

Attribute Value Description
charset char_encoding Not supported in HTML5.
Specifies the character-set of a linked document
coords coordinates Not supported in HTML5.
Specifies the coordinates of a link
download filename Specifies that the target will be downloaded when a user clicks on the hyperlink
href URL Specifies the URL of the page the link goes to
hreflang language_code Specifies the language of the linked document
media media_query Specifies what media/device the linked document is optimized for
name section_name Not supported in HTML5. Use the global id attribute instead.
Specifies the name of an anchor
rel alternate
author
bookmark
help
license
next
nofollow
noreferrer
prefetch
prev
search
tag
Specifies the relationship between the current document and the linked document
rev text Not supported in HTML5.
Specifies the relationship between the linked document and the current document
shape default
rect
circle
poly
Not supported in HTML5.
Specifies the shape of a link
target _blank
_parent
_self
_top
framename
Specifies where to open the linked document
type media_type Specifies the media type of the linked document