HTML <a> Tag


The <a> HTML element is one of the most important in HTML and is intended for creating links. To do this, you need to tell the browser what the link is, and also indicate the address of the document to which you want to link. The value of the href attribute is the address of the document to which the transition takes place. The link address can be absolute and relative. Absolute addresses work everywhere, regardless of the name of the site or web page where the link is registered. Relative links, as their name implies, are built relative to the current document or the root of the site. The <a> element is usually referred to as a link or a hyperlink.


Permitted Parents
Any element that accepts phrasing content, or any element that accepts flow content, but always excluding <a> elements.
Inline and text
Start/End Tags
Start tag: required, End tag: required


Example of the <a href="" target="_blank">a tag</a>, used in html.


Attribute Definition
href Specifies the location of a Web resource, thus defining a link between the current element (the source anchor) and the destination anchor defined by this attribute.
target Specifies the target frame to load the page into.

Possible Values:
  • _blank
  • _self
  • _top
  • _parent
rel Specifies the relationship from the current document to the anchor specified by the href attribute. Multiple values can be provided, separated by a space.

Possible Values:
  • alternate
  • author
  • bookmark
  • external
  • help
  • license
  • next
  • nofollow
  • noreferrer
  • prefetch
  • prev
  • search
  • tag
media Specifies what media/device the target URL is optimized for. Default value: all
hreflang Specifies the base language of the resource designated by href and may only be used when href is specified.
type Specifies the MIME type of the linked resource. Only to be used when the href attribute is present.

Global Attributes

The <a> tag also supports the Global Attributes in HTML5

Event Attributes

The <a> tag also supports the Event Attributes in HTML5

Browser Support

The following table will show you the current browser support for the HTML <a> tag.

Edge Chrome Firefox Opera Safari
Tablets / Mobile
Chrome Firefox Opera Safari Samsung Webview

Last updated by CSSPortal on: 30th March 2024