optgroup

FilterElements

<optgroup> ... </optgroup>

Defines a logical group of option elements within a select menu form control. An optgroup element may not contain other optgroup elements (they may not be nested).

Start/End Tags

HTML 4.01 and XHTML: Required/Required; HTML5: Required/Optional

Specifications

  • HTML 4.01
  • HTML5

disabled

Values: None in HTML. (disabled="disabled" in XHTML)
Indicates that the group of options is nonfunctional. It can be reactivated with a script.

label=

Values: text
Required. Specifies the label for the option group.
<p>What are your favorite ice cream flavors?</p>
<select name="ice_cream" size="6" multiple="multiple">
<optgroup label="traditional">
  <option>Vanilla</option>
  <option>Chocolate</option>
</optgroup>
<optgroup label="specialty">
  <option>Inside-out Rocky Road</option>
  <option>Super-duper Praline Pecan Smashup</option>
</optgroup> </select>

Rendered Example

What are your favorite ice cream flavors?

Display of option groups may vary by browser.