HTML
Example
A simple HTML form with two input fields and their associated labels:
<form action="demo_form.php">
<label for="male" Male label>
<input type="radio" name="sex" id="male" value="male">
<br>
<label for="female" Female label>
<input type="radio" name="sex" id="female" value="female">
<br>
<br>
<input type="submit" value="Submit" form>Try it »
Browser support

Currently most browsers support the
Tag Definition and Usage Notes
The label element does not render any special effect for the user. However, it improves usability for mouse users: if you click the text inside a label element, the associated control is triggered. That is, when the user selects the label, the browser automatically transfers focus to the form control associated with the label.
Tips and Notes
Tip:The "for" attribute can bind a label to another element. Set the value of the "for" attribute to the value of the id attribute of the related element.
Differences between HTML 4.01 and HTML5
The "form" attribute is new in HTML5.
property
New: new attribute in HTML5.
| property | Value | Description |
|---|---|---|
| for | element_id | Specifies which form element the label is bound to. |
| formNew | form_id | Specifies one or more forms to which the label field belongs. |