< Previous | HTML 4.01 Tags / XHTML 1.0 Elements | Next >
Free XHTML 1.0 Class | HTML Validators | Free HTML 4.01 Class
<a> Description:
Creates anchors (either hyperlinks or text references) within an XHTML document.
<a> Web Browser Support:
- AvantGo Palm OS
- AvantGo Windows CE
- Firefox 1, 2
- Internet Explorer 2, 3, 4, 5, 6, 7
- Mozilla 1
- Netscape 2, 3, 4, 6, 7, 8
- Opera 3, 4, 5, 6, 7, 8, 9
- Safari 1, 2
- WebTV/MSN TV
- HTML 3.2, 4.0
- XHTML 1.0: Client-Side Image Map Module, Hypertext Module, Intrinsic Events Module, Name Identification Module, Target Module
<a> Attributes:
All attributes are optional unless indicated.
- accesskey
- charset
- class
- coords
- dir
- href
- hreflang
- id
- lang
- name
- onblur
- onclick
- ondblclick
- onfocus
- onkeydown
- onkeypress
- onkeyup
- onmousedown
- onmousemove
- onmouseout
- onmouseover
- onmouseup
- rel
- rev
- shape
- style
- tabindex
- target
- title
- type
<a> End Tag:
</a> REQUIRED<a> Contents:
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
<a> Usage:
- 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>
View - named fragment
<a name="bottom" id="bottom">the bottom of the page</a>
link to this by typing:<a href="#bottom">link to the bottom of the page</a>
View
- link to a frame called "main"
<a href="/od/frames" target="main">frame link</a>
View - link in a series of pages
<a href="/od/htmltags/p/bltags_abbr.htm" rel="Next" rev="Prev">Next</a>
View - link with an access key
<a href="/od/accessibility/" accesskey="a">access key is a</a>
View
<a> Special Notes
- All of the attributes of the <a></a> tag are optional. The values for the element may then be set at a later time using dynamic scripts.
- Keep the <a></a> tags 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 <a></a> tags, 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 whitespace 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
Return to XHTML Element (HTML Tags) Library
< Previous | HTML 4.01 Tags / XHTML 1.0 Elements | Next >
Free XHTML 1.0 Class | HTML Validators | Free HTML 4.01 Class

