<optgroup>
HTML <optgroup> Tag
Instance
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>php中文网(php.cn)</title> </head> <body> <select> <optgroup label="Swedish Cars"> <option value="volvo">Volvo</option> <option value="saab">Saab</option> </optgroup> <optgroup label="German Cars"> <option value="mercedes">Mercedes</option> <option value="audi">Audi</option> </optgroup> </select> </body> </html>
Run Instance»
Click the "Run Instance" button to view the online instance
Browser support
Most mainstream browsers support< optgroup>label.
Tag definition and usage instructions
<optgroup> Tags are often used to group related options together.
If you have many option combinations, you can use the <optgroup> tag to easily group related options together.
Differences between HTML 4.01 and HTML5
None.
Properties
Properties | Value | Description |
---|---|---|
disabled | disabled | Specifies that this option group is disabled. |
label | text | Specifies a description for the option group. |
Global attributes
<optgroup> tag supports global attributes, see the complete attribute table HTML global attributes.
Event attributes
<optgroup> tag supports all HTML event attributes.