w3-video.com logo

HTML5 Tutorial

Home HTML5 XAMPP .htaccess Firefox Notepad++

Share it



optgroup nested within elements, elements nested within optgroup

Classified as: -

Parents, optgroup

Children, optgroup

Examples: optgroup parents, optgroup children

Valid Syntax 1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
<!doctype html>
<html>
<head>
<title>...</title>
</head>
<body>

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

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

<optgroup>...</optgroup>
<p>
<optgroup>...</optgroup>
</p>

</body>
</html>

Syntax 1: Valid, optgroup nested within select: allowed; option elements nested within optgroup: allowed
Syntax 2: Invalid, optgroup nested within elements (head, body, p) other than select: not allowed

optgroup intro optgroup optional, occurrences optgroup browser display optgroup, option: disabled attributeoptgroup syntaxoptgroup disabled attributeoptgroup label attribute