Jump to: navigation, search

HTML form label

From w3cyberlearnings

Contents

HTML - Label Tag

Label tag defines label for user input field, when user click on the label text the user input field will triggers mouse focus.

HTML - Syntax Label Tag

  • for="id", the id is the user input text field id.
<label for="input_id">Text</label>

Label Tag Attributes

Attributes value Example Description
for element_id <label for="name_id">Name:</label>
<input type="text" id="name_id"/>
specifies the user input field a label is bound to

Example 1 TRY-IT


<html>
<head>
<title>Label</title>
</head>
<body>
<form>
	<label for="name_id">Full Name</label>
	<input type="text" name="name_id" id="name_id"/><br/>
	
	<label for="state_id">State</label>
	<input type="text" name="state_id" id="state_id"/><br/>
	
	<label for="address_id">Address</label>
	<input type="text" name="address_id" id="address_id"/><br/>
</form>
</body>
</html>

Output

Html form label 1.png

Related Link


Navigation
Web
SQL
MISC
References