The <a>
tag, or Anchor element, defines a hyperlink to any URL on the web, including web pages, files, email addresses, telephone numbers, anchors on the same page – anything that a URL can address.
The most important attribute is href
, which provides the address to which the element is linked.
<a href="https://webdeveloper.com/">Visit WebDeveloper.com</a>
download
Specifies that the targeted URL will be downloaded to the users computer. Can be used with or without a value
href
Provides the address to which the element is linked.
hreflang
Identifies the language that the linked URL is in.
media
Identifies the media or device that the linked URL is optimized for.
ping
Sends post
requests with the body ping
to a comma separated list of URLs when the link is clicked.
referrerpolicy
Depending on the specified value, determines how much of the referrer to send.
rel
Depending on the specified value, specifies the relationship between the linked item and the current URL.
target
Determines where the linked URL is opened (current window, new window, etc.)
type
Provides the linked URL’s format in Mime-type.
User-submitted codepen.io examples of <a>
↴
Submit a codepen.io link that demonstrates <a>
: