label for Attribute - HTML CSS HTML Tag

HTML CSS examples for HTML Tag:label

Description

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

Attribute Values

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

Three radio buttons with labels:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<p>Click on one of the text labels to toggle the related control:</p>

<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><!--from   w ww .jav a  2 s. c o  m-->

</body>
</html>

Related Tutorials