The best HTML <optgroup> tag Tutorial In 2024, In this tutorial you can learn Examples,Browser Support,Tag definitions and instructions,HTML 4.01 and HTML5 differences in,Attributes,Global Properties,Event Properties,

HTML <optgroup> tag

Examples

By <optgroup> tag of the related options together:

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


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

Most major browsers support <optgroup> tag.


Tag definitions and instructions

<Optgroup> tag is often used for the related options together.

If you have a lot of combinations of options, you can use <optgroup> tag can be very simple to related options together.


HTML 4.01 and HTML5 differences in

no.


Attributes

属性 描述
disabled disabled 规定禁用该选项组。
label text 为选项组规定描述。


Global Properties

<optgroup> tag supports the global attributes, view complete the property sheet HTML Global Attributes .


Event Properties

<optgroup> tag supports all HTML event attributes .

HTML <optgroup> tag
10/30