HTML <optgroup> label eigenschap
Definition and usage
label
The attribute specifies the label of the option group.
Example
Two labeled option groups:
<label for="cars">Please select an auto 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 |