Anchor. Primarily used as a hypertext link. The link can be to another page, a part of a page or any other location on the web.

The <a> tag defines a hyperlink, which is used to link from one page to another. The most important attribute of the <a> element is the href attribute, which indicates the link's destination.

The target attribute can be used to specify whether to open the web page in a new browser window or not. The anchor tag can be used on an image link.

Note: An anchor (a point in a page where a link can jump to) does not need to be defined with the a tag. Applying the id attribute to any tag will achieve this.

Required Attributes

  • None.

Optional Attributes

  • href can be used to specify the target of a link.
  • charset can be used to specify the character set of the target of a link.
  • type can be used to specify the MIME type of the target of a link.
  • hreflang can be used to specify the language (in the form of a language code) of the target of a link. It should only be used when href is also used.
  • rel can be used to specify the relationship of the target of the link to the current page.
  • rev can be used to specify the relationship of the current page to the target of the link.
  • accesskey can be used to associate a keyboard shortcut to the element.
  • tabindex can be used to specify where the element appears in the tab order of the page.
  • Common attributes

Example

<a href="http://uk.news.voxquo.com">Link to a website</a>

Changes in HTML5

  • None.

Related Tags