HTML <optgroup> label Attribute
Example
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 »
Definition and Usage
The label attribute specifies a label for an option-group.
Browser Support
Attribute | |||||
---|---|---|---|---|---|
label | Yes | Yes | Yes | Yes | Yes |
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> tag