w3-video.com logo

HTML5 Tutorial

Home HTML5 XAMPP .htaccess Firefox Notepad++

Share it



span nested within elements, elements nested within span

Classified as: flow content, phrasing content, palpable content

Parents, span

Children, span

Examples: span parents, span children

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

<p>
<span>
...
</span>
</p>
<span>...</span>

</body>
</html>
Valid Syntax 2
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>

<p>
<span>
<a>
...
</a>
</span>
</p>

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

<span>
<p>...</p>
<article>
...
</article>
</span>

</body>
</html>

Syntax 1: Valid, span nested within p, body: allowed
Syntax 2: Valid, a nested within span: allowed
Syntax 3: Invalid, span nested within head: not allowed; article, p nested within span: not allowed

span intro span browser display span vs div span element vs span attributespan syntax