|
|
HTML <label> tag
Syntax
<label> - </label>
Definition and Usage
The LABEL element is used to specify labels for
controls that do not have implicit labels. The LABEL
element associates a label with a form control. By associating labels
with form controls, authors give important hints to users of speech browsers
while also allowing visual browsers to duplicate common GUI
features (e.g., the ability to
click on a text label to select a radio button or checkbox).
Optional Attributes
| Attribute |
Value |
Description |
| for |
id_of_another_field |
Defines which form element the label is for. Set to an ID
of a form element.
Note: If this attribute is not specified, the label is
associated with its contents.
|
Standard Attributes
| id, class, title, style, dir, lang, xml:lang |
For a full description, go to Standard
Attributes.
Event Attributes
| accesskey, onfocus, onblur, onclick, ondblclick,
onmousedown, onmouseup, onmouseover, onmousemove, onmouseout,
onkeypress, onkeydown, onkeyup |
For a full description, go to Event
Attributes.
Example
| Source |
Output |
<form name="input" action="">
<input type="radio" name="f1"
id="car1" />
<label for="car1">Ferrari</label>
<br />
<input type="radio" name="f1"
id="car2" />
<label for="car2">Williams</label>
</form> |
|
|
|