<optgroup>

Description

This element groups multiple options within a <select> element list together. The option groups cannot be nested within other option groups.

Example


<html>
<body>
     <form>
        <select name="select1">
           <optgroup label="First Group">
                <option>First</option>
                <option>second</option>
                <option>third</option>
           </optgroup>
           <optgroup label="Second Group">
                <option>First item in second group</option>
                <option>Second item in second group</option>
                <option>Third item in second group</option>
           </optgroup>
        </select>
     </form>
</body><!--  ww  w .j a  v  a2 s. c  om-->
</html>

Click to view the demo

The code above generates the following result.

optgroup




















Home »
  HTML CSS »
    HTML CSS Reference »




HTML Tag Reference
CSS Reference
CSS Selector Reference
Encoding Reference