optgroup

Form

<optgroup> ... </optgroup>

Attributes

attribute default description
id none specifies the unique ID
class none specifies the style sheet class
style none specifies the style sheet
name none specifies the name
value none specifies the value of the option to be sent to the server
label none specifies the lavel for the option group within a pull-down menu

Support

HTML 4.01 [STF], XHTML 1.0 [STF], XHTML 1.1
Microsoft (MSDN)
[IE6 or later][Firefox 1 or later][Safari 1 or later][Opera 7 or later][Netscape 6 or later]

Explanation

The optgroup specifies a group of option intems of the menu in a input form.

Related Tags

form, option, select

Sample Code [Output]

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=shift_jis">
<title>Sample</title>
</head>
<body>
<h1>Sample</h1>
<form method="get" action="../bbs.cgi">
<select name="Dessert">
<optgroup label="Fruits">
<option>Apple</option>
<option>Grape</option>
<option>Pear</option>
</optgroup>
<optgroup label="Confectionery">
<option>Cake</option>
<option>Pudding</option>
</optgroup>
</select>
</form>
</body>
</html>