HTML - <label> Tag



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


<!DOCTYPE html>

      <title>HTML label Tag</title>

      <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 />


This will produce the following result −

Global Attributes

This tag supports all the global attributes described in − HTML Attribute Reference

Specific Attributes

The HTML <label> tag also supports the following additional attributes −

Attribute Value Description
formhtml-5 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.

Event Attributes

This tag supports all the event attributes described in − HTML Events Reference

Browser Support

Chrome Firefox IE Opera Safari Android
Yes Yes Yes Yes Yes Yes