w3-video.com logo

HTML5 Tutorial

Home HTML5 XAMPP .htaccess Firefox Notepad++

Share it



code nested within elements, elements nested within code

Classified as: flow content, phrasing content, palpable content

Parents, code

Children, code

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

<p>
<code>...</code>
</p>

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

<p>
<code><em>...</em></code>
</p>

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

<code>
<article>...</article>
</code>

</body>
</html>

Syntax 1: Valid, code nested inside p: allowed
Syntax 2: Valid, em nested inside code: allowed
Syntax 3: Invalid, code nested inside head: not allowed; article nested inside code: not allowed

code intro code browser display code syntax