Tutorials References Exercises Bootcamps Videos Menu
Sign Up Create Website Get Certified Upgrade

HTML <optgroup> label Attribute

❮ HTML <optgroup> tag


Two option-groups with labels:

<label for="cars">Choose a car:</label>
<select  name="cars" id="cars">
  <optgroup label="Swedish Cars">
    <option value="volvo">Volvo</option>
    <option value="saab">Saab</option>
  <optgroup label="German Cars">
    <option value="mercedes">Mercedes</option>
    <option value="audi">Audi</option>
Try it Yourself »

Definition and Usage

The label attribute specifies a label for an option-group.

Browser Support

label Yes Yes Yes Yes Yes


<optgroup label="text">

Attribute Values

Value Description
text Specifies a label/description for the option-group

❮ HTML <optgroup> tag