HTML <label> form Attribute

Last Updated : 26 May, 2026

The form attribute in the <label> tag is used to associate the label with a specific form element. It allows the label to connect with a form even if it is placed outside the <form> tag.

  • Links the <label> element to a form using the form’s id.
  • Allows labels to be placed outside the <form> element.
  • Helps in creating flexible and well-structured form layouts.

Syntax:

<label form="form_id"> 

Attribute Values: The form attribute in HTML's <label> tag specifies the id of the <form> element to which the label belongs.

Example: Implementation of HTML <label> form Attribute.

HTML
<!--Driver Code Starts-->
<!DOCTYPE html>
<html>

<head>
    <title>
        HTML label form Attribute
    </title>
</head>

<!--Driver Code Ends-->

<body style="text-align:center">
    <form action="#" method="get" id="GFG_form">
        <!-- Starts label tag from here -->
        <label for="student">
            Student
        </label>

        <input type="radio" 
               name="Occupation" 
               id="student" 
               value="student">
               <br>

        <label for="business">
            Business
        </label>

        <input type="radio" 
               name="Occupation" 
               id="business" 
               value="business">
               <br>
    </form>

    <label for="other" 
           form="GFG_form">
           Other
    </label>
</body>

<!--Driver Code Starts-->

</html>
<!--Driver Code Ends-->
Comment