optgroup label Attribute - HTML CSS HTML Tag

HTML CSS examples for HTML Tag:optgroup

Description

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

Attribute Values

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

The following code shows how to create Two option-groups with labels:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<select>
  <optgroup label="Swedish Cars">
    <option value="css">CSS</option>
    <option value="java">Java</option>
  </optgroup>
  <optgroup label="German Cars">
    <option value="javascript">Javascript</option>
    <option value="sql">SQL</option>
  </optgroup>
</select><!-- ww w.j av  a 2 s.  c  o m-->

</body>
</html>

Related Tutorials