html optgroup tag | optgroup in html #html #htmlcss
HTML OPTGROUP TAG The <optgroup> tag is an HTML element used to group related <option> elements within a <select> element. It provides a way to organize and categorize options in a dropdown list. The <optgroup> tag can be used to create nested groups as well. Here's the basic syntax for using the <optgroup> tag: <select> <optgroup label="Group 1"> <option value="option1">Option 1</option> <option value="option2">Option 2</option> <option value="option3">Option 3</option> </optgroup> <optgroup label="Group 2"> <option value="option4">Option 4</option> <option value="option5">Option 5</option> <option value="option6">Option 6</option> </optgroup> </select> In the example above, we have two groups defined within the <select&