Horje

How to add HTML <label> for Attribute

Three radio buttons with labels:

Definition and Usage

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


Browser Support

Syntax

<label for="element_id">

Attribute Values

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

 

index.html
Example: HTML
 <form action="/action_page.php">
  <input type="radio" id="html" name="fav_language" value="HTML">
  <label for="html">HTML</label><br>
  <input type="radio" id="css" name="fav_language" value="CSS">
  <label for="css">CSS</label><br>
  <input type="radio" id="javascript" name="fav_language" value="JavaScript">
  <label for="javascript">JavaScript</label><br><br>
  <input type="submit" value="Submit">
</form> 

Output should be:

How to add HTML <label> for Attribute




Type:
html
Category:
Web Tutorial
Sub Category:
HTML Tag
Uploaded by:
Admin