Please note, this is a STATIC archive of website www.w3schools.com from 05 May 2020, cach3.com does not collect or store any user information, there is no "phishing" involved.
THE WORLD'S LARGEST WEB DEVELOPER SITE

HTML <label> for Attribute

❮ HTML <label> tag

Example

Three radio buttons with labels:

<form action="/action_page.php">
  <label for="male">Male</label>
  <input type="radio" name="gender" id="male" value="male"><br>
  <label for="female">Female</label>
  <input type="radio" name="gender" id="female" value="female"><br>
  <label for="other">Other</label>
  <input type="radio" name="gender" id="other" value="other"><br><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

Syntax

<label for="element_id">

Attribute Values

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

❮ HTML <label> tag