HTML label for Attribute
HTML <label> tag
Definition and Usage
The align attribute specifies the the form element the label is assigned to.
The other way of assigning a label to a for element is to wrap the <label>
tags around the form element.
However, using the for attribute is more widely supported and recommended.
Syntax
Syntax Example
Attribute Values
Value |
Description |
id |
Specifies the id of the element the label is bound to. Must
be an existing form element. |
Browser Support
The attribute is supported in all major browsers.
Example
<form action="">
<label for="text1">Name:</label>
<input type="text" id="text1" />
</form>
|
Try-It-Yourself Demos
label for
attribute example
Specify which element the label is bound to.
HTML <label> tag
|