The <label></label> assigns an informative label to form controls (one label to one control).
<label> Web Browser Support:
- Netscape 6, 7
- Mozilla 1
- Firefox 1
- Internet Explorer 4, 5, 6
- Opera 6, 7, 8
- Safari 1
- HTML 4.0
- XHTML 1.0: XHTML Basic Forms Module, XHTML Forms Module, XHTML Intrinsic Events Module
<label> Attributes:
- for (optional)
- id (optional)
- lang (optional)
- onblur (optional)
- onclick (optional)
- ondblclick (optional)
- onfocus (optional)
- onkeydown (optional)
- onkeypress (optional)
- onkeyup (optional)
- onmousedown (optional)
- onmousemove (optional)
- onmouseout (optional)
- onmouseover (optional)
- onmouseup (optional)
- onselect (optional)
- style (optional)
- title (optional)
<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