Specifies a label for a form control. | HTML 4, 4.01, 5 |
HTML Syntax
<label
accesskey = key
class = classname
datafld = colname
dataformatas = html | text
datasrc = #id
for = id
id = value
style = css_style_rules
title = text
>
Some form controls automatically have labels associated with them [push buttons], while most do not [text fields, checkboxes, radio buttons and menus].
For those controls that have implicit labels, browsers use the value of the value attribute as the label string.
The LABEL element is used to specify labels for controls that do not have implicit labels.
If the user clicks the label with the mouse, the onclick event goes to the label and then bubbles to the control specified by the htmlFor property. Pressing the accesskey for the label is the same as clicking the mouse on the label.
Labels cannot be nested.
NOTE: Both start and end tags are required.
The <label>
element supports the following attributes, in addition to global attributes common to all HTML elements.
for | element_id | Specifies the id of the form element the label should be bound to |
form | form_id | Specifies which form the label belongs to |
accessKey