HTML » Tags » optgroup

Version: 4.0

Compability: Netscape 6

Syntax:
<optgroup> ... </optgroup>

The <optgroup> tag is used to group together related items in a pull-down form control. An item can only be added to the group by using the option tag. Both the optgroup and option tags must be used inside the opening and closing select tags.

It is expected that future versions of HTML may allow this tag to create nested pull-down lists.
 
This tag is currently very poorly supported by browsers.
 
The closing tag is mandatory.
 

Examples

Code:
<select>
<optgroup label="Mexican tropical fish">
<option>Molly</option>
<option>Platy</option>
<option>Sword Tail</option>
</optgroup>
<optgroup label="Goldfish">
<option>Comet</option>
<option>Common</option>
<option>Sarasa</option>
</optgroup>
</select>
Output:
Language(s): HTML

See Also: