HTML <optgroup> label attribute
Definition and Usage
label
The attribute specifies the label of the option group.
Example
Two labeled option groups:
<label for="cars">Please select a car brand:</label> <select name="cars" id="cars"> <optgroup label="Chinese Cars"> <option value="byd">BYD</option> <option value="geely">Geely</option> </optgroup> <optgroup label="German Cars"> <option value="mercedes">Mercedes</option> <option value="audi">Audi</option> </optgroup> </select>
Syntax
<optgroup label="text">
attribute value
value | description |
---|---|
text | Specify the tag/description of the option group. |
Browser Support
Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|
Chrome | Edge | Firefox | Safari | Opera |
Support | Support | Support | Support | Support |