Html-optgroup-tag
提供:Dev Guides
HTML-<optgroup>タグ
説明
HTML <optgroup>タグは、選択リスト内の関連オプションをグループ化するために使用されます。 これにより、ユーザーは大きなリストを見るときに選択を理解しやすくなります。
例
<!DOCTYPE html>
<html>
<head>
<title>HTML optgroup Tag</title>
</head>
<body>
<select>
<optgroup label = "India">
<option value = "mumbai">Mumbai</option>
<option value = "delhi">Delhi</option>
</optgroup>
<optgroup label = "USA">
<option value = "florida">Florida</option>
<option value = "newyork">New York</option>
</optgroup>
</select>
</body>
</html>
これは、次の結果を生成します-
グローバル属性
このタグは、− link:/html/html_attributes_reference [HTML属性リファレンス]で説明されているすべてのグローバル属性をサポートします
特定の属性
HTML <optgroup>タグは、次の追加属性もサポートしています-
Attribute | Value | Description |
---|---|---|
disabled | disabled | Disables the input control. The button won’t accept changes from the user. It also cannot receive focus and will be skipped when tabbing. |
label | text | Defines a label to use when using <optgroup>. |
イベント属性
このタグは、− link:/html/html_events_reference [HTMLイベントリファレンス]で説明されているすべてのイベント属性をサポートします。
ブラウザのサポート
Chrome | Firefox | IE | Opera | Safari | Android |
---|---|---|---|---|---|
Yes | Yes | Yes | Yes | Yes | Yes |