From http://www.w3schools.com (Copyright Refsnes Data)
ExampleAn simple HTML form with two input fields and related labels :
|
The <label> tag defines a label for an input element.
The label element does not render as anything special for the user. However, it provides a usability improvement for mouse users, because if the user clicks on the text within the label element, it toggles the control.
The for attribute of the <label> tag should be equal to the id attribute of the related element to bind them together.
The <label> tag is supported in all major browsers.
Note: Not supported in Safari 2 or earlier versions.
NONE
DTD indicates in which DTD the attribute is allowed. S=Strict, T=Transitional, and F=Frameset.
Attribute | Value | Description | DTD |
---|---|---|---|
for | id_of_another_field | Defines which form element the label is for. Note: If this attribute is not specified, the label is associated with its contents. |
STF |
id, class, title, style, dir, lang, xml:lang, accesskey |
For a full description, go to Standard Attributes.
onfocus, onblur, onclick, ondblclick, onmousedown, onmouseup, onmouseover, onmousemove, onmouseout, onkeypress, onkeydown, onkeyup |
For a full description, go to Event Attributes.
From http://www.w3schools.com (Copyright Refsnes Data)