HTML Dog
Skip to navigation

HTML Tag: a

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.

Optional Attributes

Attribute Description Possible values
href The target destination of a link. URL.
target The browsing context in which the target destination should open.
  • _self: Opens link in current window / tab.
  • _blank: Opens link in a new window / tab.
download Indicates that the target should be downloaded instead of navigated to. None.
rel The relationship between the link’s page and the link’s target destination.
  • alternate: An alternative version of the current web page.
  • author: A page containing details of the author of the page / article.
  • bookmark: A link to the current section of the page.
  • help: Help specific to the context.
  • license: A copyright license for the current document.
  • next: Indicates that the page is in a sequence and the linked page is the next page in the sequence.
  • nofollow: Indicates that the linked resource is not endorsed by the current document’s author.
  • noreferrer: Tells the browser not to send an HTTP referrer header when following the link.
  • prefetch: The linked resource should be cached.
  • prev: Indicates that the page is in a sequence and the linked page is the previous page in the sequence.
  • search: A search facility that can be used to search the current, and related, documents.
  • tag: A tagging term (not to be confused with HTML tags) that applies to the link.
hreflang The language of the target of the link. It should only be used when href is also used. Language code, such as en (English) or es (Spanish).
type The MIME type of the linked resource. Text.
Global attributes

Example


<p><a href="http://www.htmldog.com">Link to a URL</a></p>

<p><a href="#content">Link to a page anchor</a></p>

<p><a href="smidgen.pdf" download>Link to a resource to download</a></p>