PUBLISHED ON: FEBRUARY 19, 2021
HTML Optgroup Tag
In HTML, the <optgroup>
tag means the grouping of options.
HTML <optgroup>
Tag Syntax and Usage
The <optgroup>
tag requires both opening (start) tag and closing(end) tag.
The basic syntax for the same is given below:
<optgroup>
..content here
</optgroup>
HTML <optgroup>
Tag Attributes
The <optgroup>
tag supports both global and event attributes and some of the common attributes are given below:
1. Disabled
This attribute is used to disable a group of options in a drop-down list.
2. Label
This attribute is used to provide a label to a group of options This attribute is a mandatory attribute.
HTML <optgroup>
Tag Basic Example
Below we have a basic example for the same:
Default CSS Settings for HTML <optgroup>
Tag
None
Browser Support for HTML <optgroup>
Tag
Following browsers support this attribute:
-
Firefox 1+
-
Google Chrome 1+
-
Internet Explorer 6+
-
Safari 1+
-
Opera 7+