HTML label Tag

The HTML <label> tag is used to defines a text label for <input>, <button>, <input>, <meter>, <output>, <progress>, <select>, or <textarea> element. It toggles the form control when anyone clicks on a label text.

The <label> tag can be used in two ways:

  1. Use the id attribute inside the <input> element and specify its name as a for attribute for the <label> tag.
  2. Use the <input> tag within the <label> element in a form.


<label>Form Content...</label>


<!DOCTYPE html>
      <title>HTML  label Tag</title>
      <h1>The label element</h1>
      <form action="/action.php">
         <label for="fname">First Name:</label>
           <input type="text"  name="fname" id="fname"><br><br>
           <label for="lname">Last Name:</label>
           <input type="text" id="lname" name="lname"><br><br>
         <input type="submit" value="Submit">


html label tag



Attribute Value Description
for element_id It Specifies the id of the form the label belongs to.
form form_id It specifies the form to which the label belongs.

Global Attributes

The <label> tag supports all the Global Attributes in HTML.

Event Attributes

The <label> tag supports all the Event Attributes in HTML.

Supported Browsers

Element Chrome Firefox IE Opera Safari
<label> Yes Yes Yes Yes Yes

Leave a Comment

Your email address will not be published.