HTML optgroup label attribute
Examples
Two with label set of options:
<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>
<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"
Browser Support
All major browsers support the label property.
Definition and Usage
label attribute option specified group description tag.
Differences between HTML 4.01 and HTML5
no.
grammar
<optgroup label="text">
Property Value
值 | 描述 |
---|---|
text | 为选项组规定标签/描述。 |
HTML <optgroup> tag