a
a
This page has been flagged with the following issues:
High-level issues:
W3C Recommendation
Summary
The a element (<a>) defines a hyperlink (a link) to any content, may be another page, another section of the same page, an image/file or it may invoke a JavaScript function.
Overview Table
| DOM Interface | HTMLAnchorElement |
|---|
Examples
View live exampleThe following examples use the a element to link to files, open a file, include an image as part of a link, define an anchor, and invoke a function.
HTML
<!-- Link to a server. --> <a href="http://www.microsoft.com">Microsoft home page.</a> <!-- Link to a file in the same directory. --> <a href="home.htm">home.htm</a> <!-- Open a file in the window specified by TARGET. --> <a target="viewer" HREF="sample.htm">Open in window</a> <!-- Include an IMG element as a part of the link. --> <a href="http://www.microsoft.com"><img src="images/bullet.png">link</a> <!-- Link to an anchor. --> <a href="#anchor">anchor</a> <!-- Define an anchor. --> <a name="anchor"> <!-- Invoke a JScript function. --> <a href="javascript:window.open()">link</a> <!-- Links to a document and uses the rel attribute to add semantics to the link. --> <a href="http://creativecommons.org/licenses/by/3.0/" rel="license">cc by 3.0</a>
Notes
Remarks
The a element requires the href or the name attribute to be specified. 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.
Optionally the rel element may be specified to provide semantic meaning to the link target.
HTML information
| Closing Tag | required |
|---|---|
| CSS Display | inline |
Related specifications
| Specification | Status | Related Changes |
|---|---|---|
| HTML 4.01 | W3C Recommendation | |
| HTML 5 | W3C Working Draft |
Compatibility
Desktop
| Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari |
|---|---|---|---|---|---|
| Basic Support | 22.0 | 16.0 | 8.0 | 12.0 |
5.1 |
Mobile
| Feature | Android | BlackBerry | Chrome for mobile | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Opera Mini | Safari Mobile |
|---|---|---|---|---|---|---|---|---|
| Basic Support | Supported (when?) | Supported (when?) | Supported (when?) | Supported (when?) | Supported (when?) | Supported (when?) | Supported (when?) | Supported (when?) |
Compatibility notes
| Browser | Version | Note |
|---|---|---|
| Internet Explorer | 8 and later | A table object does not function properly when contained within an a tag. The value of the href attribute depends on the current document compatibility mode. Internet Explorer 8 and later. When Protected Mode is enabled and a Web page contains an anchor link with a named target, Windows Internet Explorer opens the target of the link in a new window when the target has a different integrity level than the Web page containing the link. For more information, see Understanding and Working in Protected Mode Internet Explorer. |
See also
Related articles
HTML
- a
External resources
This article contains content originally from external sources.
Portions of this content come from the Mozilla Developer Network
: Article
Portions of this content come from the Microsoft Developer Network: [Windows Internet Explorer API reference Article]
This tool helps to make and review comments inline.
How to Use
insert instructions, with images, here