Latest

recent

HTML Label for Attribute

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

<label for="id">

Syntax Example

<label for="text1">

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>
HTML Label for Attribute Reviewed by 1000sourcecodes on 03:45 Rating: 5
Powered by Blogger.