HTML <optgroup> labelAttributes

HTML optgroup 标签参考手册HTML <optgroup> Tag

Examples

Two option groups with labels:

<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 ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the label attribute.


Definition and Usage

The label attribute specifies a description label for an option group.


Differences between HTML 4.01 and HTML5

None.


Syntax

<optgroup label="text">

Attribute Values

Value Description
text Specifies a label/description for the option group.


HTML optgroup 标签参考手册HTML <optgroup> Tag Other extensions