w3-video.com logo

HTML5 Tutorial

Home HTML5 XAMPP .htaccess Firefox Notepad++

Share it



caption nested within elements, elements nested within caption

Classified as: -

Parents, caption

Children, caption

Examples: caption parents, caption children

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

<table>
<caption><a>...</a></caption>
...
</table>

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

<table>
<colgroup>...
<caption>...</caption>
<colgroup>...
...
</table>

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

<p>
<caption>...</caption>
...
</p>
<caption>...</caption>

</body>
</html>

Syntax 1: Valid, caption nested inside tablecaption is the first optional child of the table element ⁄ a nested inside caption
Syntax 2: Invalid, caption is present but is not the first child of the table element
Syntax 3: Invalid, caption element(s) nested inside elements other than table: head, p, body

caption intro caption browser display caption vs figcaption caption syntax