Open In App

HTML | <optgroup> label Attribute

Improve
Improve
Like Article
Like
Save
Share
Report

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:

  • Google Chrome 1
  • Edge 12
  • Internet Explorer 5.5
  • Firefox 1
  • Apple Safari
  • Opera

Last Updated : 26 Jul, 2022
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads