HTML - Tags - <optgroup>

#96 of 147
optgroup
Prev ol

 <html>
 <body>
     <label>Choose your meal:<label>
     <select>
         <optgroup label="Meat">
             <option value="chicken">Chicken</option>
             <option value="beef">Beef</option>
         </optgroup>
         <optgroup label="Veggie">
             <option value="eggplant">Eggplant</option>
             <option value="pasta">Pasta</option>
         </optgroup>
     </select>
 </body>
 </html>
 

The optgroup element creates a group of options that can be included inside of a select list.

A live example:



N of

Ads by Google


Ask a question, send a comment, or report a problem - click here to contact me.

© Richard McGrath