<optgroup> - オプショングループ
目次
概要
- 形式
<optgroup>~</optgroup>- サポート
- https://caniuse.com/mdn-html_elements_optgroup
- カテゴリ
- 該当無し
- 親要素
- select要素
- 子要素
- option, スクリプトサポート要素
- タグの省略
- 開始タグ: 必須
- 終了タグ: 他の optgroup 要素が続く場合や、最後の要素となる場合は省略可能。
- 属性
- グローバル属性
- disabled
- label
説明
<option> をグループ化して表示します。
属性
- グローバル属性
- 詳細は グローバル属性 を参照してください。
- disabled
- LS/H4/e8/Ch/Fx/Sa/Op/N6
- この選択項目を無効にします。
- label
- LS/H4/e6/Ch/Fx/Sa/Op/N6
- 選択項目のラベルを指定します。これは、<optgroup>~</optgroup> で囲まれたテキストの代わりに表示されます。HTML4.01では必須の属性として定義されています。
使用例
HTML
<select>
<optgroup label="Modern Browser">
<option>Google Chrome
<option>Microsoft Edge
<option>Firefox
<option>Safari
<option>Opera
<option>その他
</optgroup>
<optgroup label="Legacy Browser">
<option>Internet Explorer 11
<option>Netscape 6
</optgroup>
</select>
表示
関連項目
リンク
- https://html.spec.whatwg.org/multipage/form-elements.html#the-optgroup-element
- https://developer.mozilla.org/ja/docs/Web/HTML/Element/optgroup
- https://caniuse.com/mdn-html_elements_optgroup
Copyright (C) 2000-2024 杜甫々
初版:2000年10月9日 最終更新:2024年12月31日
https://www.tohoho-web.com/html/optgroup.htm