w3-video.com logo

HTML5 Tutorial

Home HTML5 XAMPP .htaccess Firefox Notepad++

Share it



main nested within elements, elements nested within main

Classified as: flow content, palpable content

Parents, main

Children, main

Examples: main parents, main 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>

<main>

</main>

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

<main>
<p>...</p>
<img>
...
</main>

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

<article>
<main>
...
</main>
</article>

</body>
</html>

Syntax 1: Valid, main element nested inside body element: allowed
Syntax 2: Valid, p, img elements nested inside main element: allowed
Syntax 3: Invalid, main element nested inside head element: not allowed; main element nested inside article element: not allowed

main intro main syntax