w3-video.com logo

HTML5 Tutorial

Home HTML5 XAMPP .htaccess Firefox Notepad++

Share it



pre nested within elements, elements nested within pre

Classified as: flow content, palpable content

Parents, pre

Children, pre

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

<pre>

</pre>

</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>

<pre>
<code>
...
</code>
</pre>

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

<h1>
<pre>...</pre>
</h1>

<p>
<pre>...</pre>
</p>

</body>
</html>

Syntax 1: Valid, pre nested within body: allowed
Syntax 2: Valid, code nested within pre: allowed
Syntax 3: Invalid, pre nested within head, h1, p: not allowed

pre intro pre browser display pre syntax