HTML <optgroup> Tag


The optgroup tag generates a group of options within a <select> control's dropdown list of values.

A sequence of <option> tags define the dropdown values, which are then grouped using the <optgroup> tag.

The <optgroup> label value will appear as a grey heading above the grouped items in the choose control. The <optgroup> element is another popular name for this tag.

Syntax

Example

Preview

Attributes

Attribute Value Description
disabled disabled The user will be unable to interact with the <select> control if this value is true.
label text The heading that shows above the <select> control's grouped options.

Supported Browsers

Element Chrome Firefox Safari Edge / IE Opera
<optgroup> Yes Yes Yes Yes Yes