HTML <label> Tag
The label tag creates a caption for a user input element such as a button, input, meter, output, progress, select, or textarea tag.
The <label>
element is also a common name for this tag.
The <label>
tag defines a label for several elements:
- <input type="checkbox">
- <input type="color">
- <input type="date">
- <input type="datetime-local">
- <input type="email">
- <input type="file">
- <input type="month">
- <input type="number">
- <input type="password">
- <input type="radio">
- <input type="range">
- <input type="search">
- <input type="tel">
- <input type="text">
- <input type="time">
- <input type="url">
- <input type="week">
- <meter>
- <progress>
- <select>
- <textarea>
Syntax
Attributes
Attribute | Value | Description |
---|---|---|
for | element-id | This is used to link the label to another control. In the case of an input, the id value for the input must match the value provided in the for attribute in order for the two elements to be associated. |
form | form-id | The type of label that it is. |
Supported Browsers
Element | Chrome | Firefox | Safari | Edge / IE | Opera |
---|---|---|---|---|---|
<label> | Yes | Yes | Yes | Yes | Yes |