HTML XHTML The Complete Reference
home » reference » appendix a » html element reference

<optgroup> (Option Grouping)

This element specifies a grouping of items in a selection list defined by option elements so that the menu choices can be presented in a hierarchical menu or similar alternative fashion to improve access through nonvisual browsers.

Standard Syntax

class="class name(s)"
dir="ltr | rtl"
id="unique alphanumeric identifier"
label="text description"
lang="language code"
style="style information"
title="advisory text">

option elements

Standard Event Attributes

onclick, ondblclick, onkeydown, onkeypress, onkeyup, onmousedown, onmousemove, onmouseout, onmouseover, onmouseup

Element Specific Attributes

Occurrence of this attribute indicates that the enclosed set of options is disabled.

This attribute contains a short label that might be more appealing to use when the selection list is rendered as items in a hierarchy.


Where would you like to go for your vacation?
<select name="vacation" id="vacation">
<option id="ch1" value="Hong Kong"> Hong Kong</option>
<optgroup label="South Pacific">
 <option id="ch2" label="Australia" value="Australia">Australia</option>
 <option id="ch3" label="Fiji" value="Fiji">Wakaya (Fiji Islands)</option>
 <option id="ch4" value="New Zealand">New Zealand</option>
<option id="ch5" value="home" selected="selected">Your backyard</option>


HTML 4, 4.01
XHTML 1.0, 1.1
Internet Explorer 6
Netscape 6, 7
Opera 7


This element should occur only within the context of a select element.

Only the most modern browsers present this element in a visually meaningful fashion.

(X)HTML Elements
CSS Properties
Previous: ol Next: option
< Home | About | Chapters | Examples | Errata | Reference | Site Map >