w3-video.com logo

HTML5 Tutorial

Home HTML5 XAMPP .htaccess Firefox Notepad++

Share it



li nested within elements, elements nested within li

Classified as: -

Parents, li

Children, li

Examples: li parents, li children

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

<ol>
<li>...</li>
<li>...</li>
</ol>

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

<menu type="toolbar" >
<li>...</li>
<li>...</li>
</menu>

</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>
<li>...</li>
</head>
<body>

<p>
<li>...</li>
</p>
<li>...</li>

</body>
</html>

Syntax 1: Valid, li elements can be nested only inside: ol, ul, menu;
Syntax 2: Invalid, li elements nested within head, p, body: not allowed

Video demonstration nesting li

HTML5 nesting li Tutorial

min video details
00:05 li element cannot be added in head section, only in body section
00:11 once or multiple times
00:17 AND ONLY inside any of the next 3 HTML elements:
ul
ol
menu
li intro li browser display li syntaxli value attribute