HTML <optgroup> tag

Usage

Defines a group of options within a form.

Example

Code:

<select>
<optgroup label="Animals">
<option value="cat">Cat</option>
<option value="dog">Dog</option>
<option value="hamster">Hamster</option>
</optgroup>
</select>

Output:

Required Attributes

  • label - gives the option group a label

Optional Attributes

  • disabled - disables the entire group by default

Core Attributes