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
 |
|
Get Your Diploma!
W3Schools' Online Certification Program is the perfect solution for busy
professionals who need to balance work, family, and career building.
The HTML Certificate is for developers who want to document their knowledge of HTML, XHTML, and CSS.
The JavaScript Certificate is for developers who want to document their knowledge of JavaScript and the HTML DOM.
The XML Certificate is for developers who want to document their knowledge of XML, XML DOM and XSLT.
The ASP Certificate is for developers who want to document their knowledge of ASP, SQL, and ADO.
The PHP Certificate is for developers who want to document their knowledge of PHP and SQL (MySQL).
|
|