HTML <optgroup>Tag


Examples

Use the <optgroup> tag to group related options together:

<select>
  <optgroup label="Swedish Cars">
    <option value="volvo">Volvo</option>
    <option value="saab">Saab</option>
  </optgroup>
  <optgroup label="German Cars">
    <option value="mercedes">Mercedes</option>
    <option value="audi">Audi</option>
  </optgroup>
</select>

Try it Yourself »

Browser Support

Internet Explorer Firefox Opera Google Chrome Safari

Most mainstream browsers support the <optgroup> tag.


Tag Definition and Usage

The <optgroup> tag is often used to group related options together.

If you have many groups of options, you can use the <optgroup> tag to easily group related options together.


Differences between HTML 4.01 and HTML5

None.


Attributes

Attribute Value Description
disabled disabled Specifies that the option group is disabled.
label text Specifies a description for the option group.


Global Attributes

The <optgroup> tag supports global attributes. View the complete attribute tableHTML Global Attributes。


Event Attributes

The <optgroup> tag supports allHTML Event Attributes。

Other Extensions