1. Home
  2. Computing & Technology
  3. Web Design / HTML

<a></a>

By , About.com Guide

< 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:
<a> Attributes:

All attributes are optional unless indicated.

<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

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

Explore Web Design / HTML
About.com Special Features

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

Easy ways to connect two computers for networking purposes. More >

  1. Home
  2. Computing & Technology
  3. Web Design / HTML

©2009 About.com, a part of The New York Times Company.

All rights reserved.