The WebPlatform project has been discontinued when the Stewards partnership agreement ended in September 2015. This site has been frozen, and the assets we have created will remain.
This article is In Progress.
Defines a hyperlink, a destination of hyperlink, or both.
a element defines a hyperlink to any content, which could be an external site, another page on the same site, a section within the same page, an image, or a local file.
<a href="[URI]">[Anchor text or image tag]</a>
<a id="#[identifier]">[Anchor text or image tag]</a>
<a>[Anchor text or image tag]</a>
HTML enclosed by the
<a></a> tags is typically text or an image. It is displayed in the page and (if the href attribute is present) is rendered as a link.
|download||text||File name to show in Save dialog||
|href||URI||Target of link||
|id||identifier text||Creates an anchor in the page that can be referred to by href||
|hreflang||Language tag for HTML5 or for HTML4||Hint for language of target. May be used with rel="alternate" as a hint to the server for which language to provide.|| |
|rel||comma-separated list of keywords||Indicates the relationship of the link target to the current page||
|target||Browsing context||Tells where to open the link when it is followed||
Both text and images can be included within an anchor. An image that is an anchor has a border whose color indicates whether the link has been visited. To prevent this border from appearing, you can set the img element's border attribute to 0 or omit the border attribute. You can also use CSS attributes to override the default appearance of a and img elements.
The URI may refer to any protocol, e.g. http, mailto, file. A fragment (# followed by text) refers to a location in the current page. href may be omitted to indicate a placeholder link, such as a reference to the current page in a menu.
Optionally the rel element may be specified to provide semantic meaning to the link target.
Internationalization topics related to the
Clicking and focus
Whether clicking on an anchor causes it to (by default) become focused varies by browser and OS.
Does clicking on an anchor give it the focus?
|Desktop Browsers||Windows 8.1||OS X 10.9|
|Safari 7.0.5||N/A||Only when it has a |
|Internet Explorer 11||Yes||N/A|
|Presto (Opera 12)||Yes||???|
Does tapping on an anchor give it the focus?
|Mobile Browsers||iOS 7.1.2||Android 4.4.4|
|Safari Mobile||Only when it has a
|Chrome 35||???||Only when it has a |
|HTML 5.1||W3C Working Draft|
|HTML 5||W3C Recommendation|
|HTML 4.01||W3C Recommendation|