w3-video.com logo

HTML5 Tutorial

Home HTML5 XAMPP .htaccess Firefox Notepad++

Share it



ul nested within elements, elements nested within ul

Classified as: flow content, palpable content (if li child present)

Parents, ul

Children, ul

Examples: ul parents, ul children

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

<ul>
...
</ul>

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

<ul>
<li>...
<ul>
<li>...</li>
<li>...</li>
</ul>
</li>
<li>...</li>
</ul>

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

<h1>...
<ul>
<p>...</p>
<h1>...</h1>
<a>...</a>
</ul>
</h1>

</body>
</html>

Syntax 1: Valid, ul nested within body: allowed
Syntax 2: Valid, li elements nested within ul: allowed; ul nested within li: allowed
Syntax 3: Invalid, ul nested within head, h1: not allowed; elements (p, h1, a) other than li nested within ul: not allowed

ul intro ul optional, occurrences ul browser display ul syntax