<LABEL> | NN 6 IE 4 HTML 4
<LABEL>...</LABEL> | HTML End Tag: Required
The label element defines a structure and container for the label associated with an input element. Because the rendered labels for most form controls are not part of the element's tag, the label attribute provides a way for an author to associate the context of the label with its control. A label element also simplifies assigning uniform styles to all form labels.

You have two ways to provide the association. One is to assign the id attribute value of the control to the for attribute of the label element. The other is to wrap the input element inside a label element. The latter is possible only if the label and control are part of running body content; if you must physically separate the label from the control because they exist inside separate td elements of a table, you must use the for attribute linkage. Whether the label is rendered in front of or after the control depends entirely on the relative locations of the tags in the source code.

Example
    <FORM>
    <LABEL>Company:<INPUT type="text" name="company"></LABEL><BR>
    <LABEL for="stateEntry">State:</LABEL>
    <INPUT type="text" name="state" id="stateEntry">
    ...
    </FORM>
Object Model Reference
    [window.]document.getElementById(elementID)
Element-Specific Attributes

accesskey | datafld | dataformatas | datasrc | for

Element-Specific Event Handler Attributes
None.

accesskey | NN 6 IE 4 HTML 4
accesskey="character" | Optional
A single character key that brings focus to, or activates, the associated input element. See the description of this shared attribute at the beginning of this chapter for general characteristics.
Example
    <LABEL for="stateEntry" accesskey="s">State:</LABEL>
Value
Single character of the document set.
Default
None.
Object Model Reference
    [window.]document.getElementById(elementID).accessKey

datafld | NN n/a IE 4 HTML n/a
datafld="columnName" | Optional
Used with IE data binding to associate a remote data source column name with the label of an input element. The data source column must be either plain text or HTML (see dataformatas). A datasrc attribute must also be set for the label element. Works only with text file data sources in IE 5/Mac.
Example
    <LABEL for="stateEntry" datasrc="DBSRC3" datafld="label" dataformatas="HTML">
    </LABEL>
Value
Case-sensitive identifier.
Default
None.
Object Model Reference
    [window.]document.getElementById(elementID).dataFld

dataformatas | NN n/a IE 4 HTML n/a
dataformatas="dataType" | Optional
Used with IE data binding, this attribute advises the browser whether the source material arriving from the data source is to be treated as plain text or as tagged HTML. This attribute setting depends entirely on how the data source is constructed. Works only with text file data sources in IE 5/Mac.
Example
    <LABEL for="stateEntry" datasrc="DBSRC3" datafld="label" dataformatas="HTML">
    </LABEL>
Value
IE recognizes two possible settings: text | html.
Default
text
Object Model Reference
    [window.]document.getElementById(elementID).dataFormatAs

datasrc | NN n/a IE 4 HTML n/a
datasrc="dataSourceName" | Optional
Used with IE data binding to specify the ID of the page's object element that loads the data source object for remote data access. Content from the data source is specified via the datafld attribute. Works only with text file data sources in IE 5/Mac.
Example
    <LABEL for="stateEntry" datasrc="DBSRC3" datafld="label" dataformatas="HTML">
    </LABEL>
Value
Case-sensitive identifier.
Default
None.
Object Model Reference
    [window.]document.getElementById(elementID).dataSrc

for | NN 6 IE 4 HTML 4
for="inputElementIdentifier" | Optional
A unique identifier that is also assigned to the id attribute of the input element to which the label is to be associated. The for attribute is necessary only when you elect not to wrap the input element inside the label element, in which case the for attribute performs the binding between the two elements.
Example
    <LABEL for="stateEntry">State:</LABEL>
Value
Case-sensitive identifier.
Default
None.
Object Model Reference
    [window.]document.getElementById(elementID).htmlFor

lang | NN 3 IE 4 HTML 4
lang="languageCode" | Optional
The language being used for the element's attribute values and content. A browser can use this information to assist in proper rendering of content with respect to details such as treatment of ligatures (when supported by a particular font or required by a written language), quotation marks, and hyphenation. Other applications and search engines might use this information to aid the selection of spell-checking dictionaries and the creation of indices.
Example
    <SPAN lang="de">Deutsche Bundesbahn</SPAN>
Value
Case-insensitive language code.
Default
Browser default.
Object Model Reference
    [window.]document.getElementById(elementID).lang

tabindex | NN 6 IE 4 HTML 4
tabindex="integer" | Optional
A number that indicates the sequence of this element within the tabbing order of all focusable elements in the document. Tabbing order follows a strict set of rules. Elements that have values other than zero assigned to their tabindex attributes are first in line when a user starts tabbing in a page. Focus starts with the element with the lowest tabindex value and proceeds in order to the highest value, regardless of physical location on the page or in the document. If two elements have the same tabindex values, the element that comes earlier in the document receives focus first. Next come all elements that either don't support the tabindex attribute or have the value set to zero. These elements receive focus in the order in which they appear in the document. Note that reloading the current page does not necessarily restart the tabbing sequence from the "top." Therefore, controlling tabbing sequence is most helpful when the logic of your focusable elements is something other than the source code order of those elements (e.g., directing tabbing to fields down table columns rather than across rows).

HTML 4 and Netscape 6 limit the tabindex attribute to the following elements: a, area, button, input, object, select, textarea. To this list, IE 4 adds applet, body, div, embed, isindex, marquee, span, table, and td. IE 5 adds every other renderable element. A negative value in IE (only) removes an element from tabbing order entirely.

Links and anchors cannot be tabbed to with the Mac version of IE 4, so the tabindex for a elements is ignored in that version.

Example
    <A href="chapter3.html" tabindex="3">Chapter 3</A>
Value
Any integer from 0 through 32,767. In IE, setting tabindex to a negative value causes the element to be skipped in tabbing order altogether.
Default
None.
Object Model Reference
    [window.]document.getElementById(elementID).tabIndex