HTML <label> for Attribute

HTML label Tag Reference HTML <label> tag

Example

Two radio buttons with labels:

<form action="demo_form.asp">
  <label for="male">Male</label>
  <input type="radio" name="sex" id="male" value="male"><br>
  <label for="female">Female</label>
  <input type="radio" name="sex" id="female" value="female"><br>
  <input type="submit" value="Submit">
</form>

Try it Yourself »

Definition and Usage

The for attribute specifies which form element a label is bound to.


Browser Support

Attribute
for Yes Yes Yes Yes Yes


Differences Between HTML 4.01 and HTML5

NONE.


Syntax

<label for="element_id">

Attribute Values

Value Description
element_id The id of the element the label is bound to


HTML label Tag Reference HTML <label> tag

Color Picker

colorpicker