Posts in current category

HTML5 <optgroup> tag

May 03, 2021 17:00 HTML5

Table of contents


Html5 and optgroup tags are used to define a group of options that can be combined with options in a document. Please refer to this example below:

Put the relevant options together by using the hashtag:

  <optgroup label="Swedish Cars">
    <option value="volvo">Volvo</option>
    <option value="saab">Saab</option>
  <optgroup label="German Cars">
    <option value="mercedes">Mercedes</option>
    <option value="audi">Audi</option>
Try it out . . .

Browser support

HTML5 <optgroup> tag HTML5 <optgroup> tag HTML5 <optgroup> tag HTML5 <optgroup> tag HTML5 <optgroup> tag

Most mainstream browsers support the hashtag.

Label definition and instructions for use

The label is often used to group the relevant options together.

If you have a lot of options combined, you can use the hashtag to easily put the relevant options together.

The difference between HTML 4.01 and HTML5



Property Value Describe
disabled disabled Provides that the option group is disabled.
label text Specify a description for the option group.

Global properties

The label supports global properties and views the full property sheet HTML global properties.

The event property

The label supports all HTML event properties.