a tag creates links (both anchors within the current page and to external pages) within an HTML document.
HTML5 also allows the creation of placeholder links by using the
a tag without any attributes.
A Web Browser Support:
- AvantGo Palm OS
- AvantGo Windows CE
- Chrome 1, 2, 3, 4, 5, 6, 7, 8, 9
- Firefox 1, 2, 3, 4
- Internet Explorer 2, 3, 4, 5, 6, 7, 8, 9
- Netscape 2, 3, 4, 6, 7, 8
- Opera 3, 4, 5, 6, 7, 8, 9, 10, 11
- Safari 1, 2, 3, 4, 5
- WebTV/MSN TV
A End Tag:
CDATA Any text that you want linked. The following tags are valid within the <a> tag:
acronym, applet, b, basefont, bdo, big, br, button, cite, code, dfn, em, font, i, iframe, img, input, kbd, label, map, object, q, s, samp, script, select, small, span, strike, strong, sub, textarea, tt, u, var
A Valid Context:
The <a> tag is valid within the following tags:
acronym, address, applet, b, bdo, big, blockquote, body, caption, center, cite, code, dd, del, dfn, div, dt, em, fieldset, font, form, h1, h2, h3, h4, h5, h6, i, iframe, ins, kbd, label, legend, li, noframes, noscript, object, p, pre, q, s, samp, small, span, strike, strong, sub, sup, td, th, u, var
- standard link with a title
<a href="http://webdesign.about.com/" title="About.com Web Design and HTML">Web Design / HTML at About.com</a>
- named fragment
link to this by typing:
<a name="bottom" id="bottom">the bottom of the page</a>
<a href="#bottom">link to the bottom of the page</a>
- link to a frame called "main"
<a href="/od/frames" target="main">frame link</a>
- link in a series of pages
<a href="/od/htmltags/p/bltags_abbr.htm" rel="Next" rev="Prev">Next</a>
- link with an access key
<a href="/od/accessibility/" accesskey="a">access key is a</a>
A Special Notes:
- All of the attributes of the
atag are optional. The values for the element may then be set at a later time using dynamic scripts.
- Keep the
atags as the innermost tag in a nest of tags. This isn't required, but it makes the code cleaner and easier to script.
- If you set a target on a link and you're not in a
frameset, that link will open in a new window with the name of that target.
- Links with access keys will open when that access key is pressed in conjunction with the alt or command key on the keyboard. This makes pages more accessible.
- Do not nest multiple
atags, this is not allowed.
- When creating image links, make sure that the closing
</a>tag is flush with the final
>of the image tag. Otherwise, some browsers display the additional white space as a small underscore beside the image.
More A Information
- Adding Links
- How to Write Internal Links
- Creating Better Links
- How to Open a Link in a New Window
- Mail Links
- How to Remove the Underlines From Links