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

<label></label>

By , About.com Guide

<label> Description:

The <label></label> assigns an informative label to form controls (one label to one control).

<label> Web Browser Support:
<label> Attributes:
<label> End Tag:
</label> REQUIRED
<label> Contents:

Text CDATA. The following tags are valid within the <label> tag:
a, abbr, 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, sup, textarea, tt, u, var

<label> Valid Context:

The <label> tag is valid within the following tags:
form

<label> Usage:
  • Standard <label>
    <form>
    <label for="firstname">
    First Name:
    </label>
    <input type="text" name="firstname" id="firstname" />
    </form>
  • <label> surrounding the form element
    <form>
    <label>
    First Name:
    <input type="text" name="firstname" />
    </label>
    </form>
<label> Special Notes:
  • If you place your label in one table cell and the control in another, you will need to use the for attribute to define the explicit control associated with the label.
  • The label can receive focus, with the onfocus attribute. When this happens, the focus is transferred to the associated control.
  • Labels are used by browser agents in different ways, including visually, read aloud, and so on. Be sure to test in several browsers so that it displays as you expect.
More <label> Information:
  • Coming Soon

Return to XHTML Element (HTML Tags) Library

Explore Web Design / HTML
About.com Special Features

Holiday Central

What to eat, where to go, fun things to do and how to save money on the perfect gifts. More >

Family Tech Center

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

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

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

All rights reserved.