| 文書型 | 適用 | 子要素 | 開始タグ | 終了タグ | 分類 | 
|---|---|---|---|---|---|
| Strict | ○ | option要素 | 必須 | 必須 | select要素の子要素 | 
| Transitional | ○ | ||||
| Frameset | ○ | 
複数のoption要素をグループに分けるための要素です。label属性でグループのラベルを設定します。対応ブラウザであればメニューが階層化されて表示されます。未対応のブラウザであれば<optgroup>タグは無視され、通常のメニューリストのように表示されるはずです。
<p>
  <select name="ua">
    <optgroup label="Internet Explorer">
      <option>Internet Explorer 6</option>
      <option>Internet Explorer 5.5</option>
      <option>Internet Explorer 5</option>
      <option>Internet Explorer 4</option>
    </optgroup>
    <optgroup label="Netscape">
      <option>Netscape Browser 8.x</option>
      <option>Netscape 7.x</option>
      <option>Netscape 6.x</option>
      <option>Netscape Navigator 4.x</option>
    </optgroup>
  </select>
</p>
<!ELEMENT OPTGROUP - - (OPTION)+ -- option group -->
<!ATTLIST OPTGROUP
  %attrs;                              -- %coreattrs, %i18n, %events --
  disabled    (disabled)     #IMPLIED  -- unavailable in this context --
  label       %Text;         #REQUIRED -- for use in hierarchical menus --
  >