Publish in HTML Tutorial el 25/05/2025 14:12
The <optgroup> HTML element creates a grouping of options within a <select> dropdown menu. It provides a way to organize related options under a common label, making long dropdown lists more user-friendly and easier to navigate.
Key characteristics:
A simple example grouping countries by continents:
Showing how to disable an entire group of options:
Using JavaScript to style options based on their group:
Creating option groups dynamically with JavaScript:
Using optgroup with a multiple selection dropdown:
The <style> HTML element contains style information for a document, or part of a document. ...
The <strong> element is used to indicate that its content has strong importance, seriousnes...
The <span> element is an inline container used to mark up a part of a text or document. Unl...
The <source> element is used to specify multiple media resources for media elements like &l...
The <small> element is used to represent side-comments and small print, typically for discl...
HTML <section> Element: The Complete Guide The <section> element is a semantic HTML ...