Description:

The <a> tag defines an anchor. An anchor can be used in two ways:

- To create a link to another document, by using the href attribute
- To create a bookmark inside a document, by using the name attribute

The <a> element is usually referred to as a link or a hyperlink.

The most important attribute of the <a> element is the href attribute, which indicates the link’s destination.

Example Code:

Example of the <a href="http://www.htmlportal.net/tags/tag-a.php" target="_blank">a tag</a>, used in html.

Result:

Example of the a tag, used in html.

Attributes:
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