HTML <label>Tag
Examples
A simple HTML form with two input fields and associated labels:
Try it Yourself »
Browser Support
![]()
Most browsers currently support the <label> tag.
Tag Definition and Usage Instructions
The <label> tag defines a label (mark) for the input element.
The label element does not render any special effects to the user. However, it improves usability for mouse users. If you click text within the label element, this control is triggered. That is, when the user selects the label, the browser automatically transfers focus to the form control associated with the label.
The for attribute of the <label> tag should be the same as the id attribute of the related element.
Tips and Notes
Tip:The "for" attribute can bind the 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.
Attributes
New: New in HTML5.
| Attribute | 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. |
Global Attributes
The <label> tag supports global attributes. View the full attribute tableHTML Global Attributes。
Event Attributes
The <label> tag supports allHTML Event Attributes。
Other Extensions