content logo

Learn HTML:

Html label tag

The HTML <label> tag is used to add a label to a form control like text, textarea etc.

 

Example

<!DOCTYPE html>
<html>
<head>
<title>HTML label Tag</title>
</head>
<body>
<label for="email">EMAIL-ID:<br /> <input type="email" value="" name="emailid" size="30" placeholder="Enter a valid email address"><br /><br />
<label for="phone">PHONE NO:<br /> <input type="text" value="" name="phno" size="30" maxlength="10" placeholder="Enter a valid phone number" pattern="[0-9]{10}"><br /><br />
</body>
</html>

This will produce following result:

EMAIL-ID:

PHONE NO:
 

Specific Attributes

 The HTML <label> tag also supports following additional attributes:

Attribute Value Description
form form_id It specifies one or more forms the label belongs to
for control id Specifies the input control that this label is for. This value must be the same as the value in the input control's "id" attribute.
#

HTML Lable Example

#

HTML Lable Code

#

HTML Lable Tutorial