< All the HTML Tags >

<optgroup></optgroup>

Video Coming Soon...

  • optgroup

    Tag Type

    block

    Tag Category

    forms

    Groups related options in a dropdown list

    Viewed

    1

    Examples

    1

Definition:

The HTML <optgroup> tag is used to group related <option> elements within a dropdown list, providing a structured format for selecting options.

It enhances user experience by visually categorizing options, making it easier for users to find what they're looking for in a large list.

Incorporating the `<optgroup>` tag improves the organization of dropdown menus in forms.

Attributes:

disabled, label, Global attributes (e.g., class, id, style)

Accessibility:

Coming Soon…

Default optgroup Example:

Using the <optgroup> tag to group options.
<select><optgroup label="Fruits"><option value="apple">Apple</option><option value="banana">Banana</option></optgroup></select>

Default optgroup Result:


Coming Soon…

Community Examples:

Coming Soon…
Coming Soon…