<optgroup>: The HTML Option Group Element
1 Description
The HTML
<optgroup>
element
stands for 'option group'. The <optgroup>
element is used to create a 'group' of options in a dropdown menu.
The <select>
element.
The <option>
element.
2 Examples
<!DOCTYPE html>
<html>
<head>
<title>Example Page</title>
</head>
<body>
<h1>Example HTML Page</h1>
<p>
Below is an example of a dropdown menu created
using the select, optgroup, and option html elements.
</p>
<h2>Dinner Menu</h2>
<select label="Menu Options">
<optgroup label="Appetizers">
<option>Caesar salad with croutons</option>
<option>Lentil soup</option>
<option>Garlic breadsticks</option>
</optgroup>
<optgroup label="Entrees">
<option>Spaghetti and meatballs in a rich marinara sauce</option>
<option>Pepperoni pizza with olives and fennel sausage</option>
<option>Fettuccine alfredo pasta and roast chicken</option>
</optgroup>
<optgroup label="Desserts">
<option>Strawberry gelato</option>
<option>Lemon tiramisu</option>
<option>Ricotta pie</option>
</optgroup>
</select>
</body>
</html>
This document was last updated: