Loading...
HTML <label> Tag

HTML <label> Tag

In this tutorial, we will learn about label tag in HTML with the help of examples.


<label> Tag

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

Syntax

<label>........</label>

Example

<!DOCTYPE html>
<html>
  <head>
    <title>Label Tag</title>
  </head>
  <body>
    <label for = "name">Name :</label>
    <input type = "text" id = "name" placeholder = "Enter your name"><br>
  </body>
</html>

Output



Specific Attribute

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 is for that specific element.
This value must be the same as the value in the input control's id attribute

Global Attribute

Label Tag support all the global attributes of HTML.


Event Attribute

Label Tag support all the event attributes of HTML.


Next Tutorial

We hope that this tutorial helped you develop better understanding of the concept of <label> tag in HTML.

Keep Learning : )

In the next tutorial, you'll learn about HTML <legend> Tag.

- Related Topics