w3-video.com logo

HTML5 Tutorial

Home HTML5 XAMPP .htaccess Firefox Notepad++

Share it



optgroup ... ⁄optgroup, optional element ⁄occurrences

The optgroup element is optional.
The optgroup element can be added multiple times per HTML5 document within the select element

Examples:

Valid Syntax 1
optgroup absent; optional element
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<!doctype html>
<html>
<head>
<title>...</title>
</head>
<body>

<select>
<option>...</option>
<option>...</option>
<option>...</option>
</select>

</body>
</html>
Valid Syntax 2
multiple optgroup elements present
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<!doctype html>
<html>
<head>
<title>...</title>
</head>
<body>

<select>
<optgroup>
<option>...</option>
<option>...</option>
<option>...</option>
</optgroup>
<optgroup>
<option>...</option>
<option>...</option>
<option>...</option>
</optgroup>
</select>

</body>
</html>
optgroup intro optgroup browser display optgroup parents - children optgroup, option: disabled attributeoptgroup syntaxoptgroup disabled attributeoptgroup label attribute