Open In App

HTML | <optgroup> label Attribute

The HTML optgroup label Attribute is used to specify a label for an <optgroup> Element.

Syntax:



<optgroup label="text"> 

Attribute Values: It contains the value i.e text which specify the description for a optgroup Element.

Example:




<!DOCTYPE html>
<html>
  
<head>
    <title>HTML
        <optgroup>
            label Attribute
    </title>
</head>
  
<body style="text-align:center">
    <h1 style="color: green;">
      GeeksforGeeks
  </h1>
    <h2>HTML optgroup label Attribute</h2>
  
    <select>
        <!--A label optgroup-->
        <optgroup label="Sorting Algorithms">
            <option value="merge">
                Merge sort
            </option>
            <option value="quick">
                Quick sort
            </option>
        </optgroup>
    </select>
</body>
  
</html>

Output:



Supported Browsers: The browsers supported by HTML optgroup label Attribute are listed below:

Article Tags :