w3-video.com logo

HTML5 Tutorial

Home HTML5 XAMPP .htaccess Firefox Notepad++

Share it



tr nested within elements, elements nested within tr

Classified as: -

Parents, tr

Children, tr

Examples: tr parents, tr children

Valid Syntax 1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
<!doctype html>
<html>
<head>
<title>...</title>
</head>
<body>

<table>
<caption>...</caption>
<thead>
<tr><th>...<th>...</tr>
</thead>
<tfoot>
<tr><td>...<td>...</tr>
<tr>...</tr>
</tfoot>
<tbody>
<tr>...</tr>
<tr>...</tr>
</tbody>
</table>

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

<table>
<caption>...</caption>
<thead>..</thead>
<tr><td>...<td>...</tr>
<tr>...</tr>
<tr>...</tr>
</table>

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

<tr>...
<table>
<caption>...</caption>
<tr>...</tr>
<tr>...</tr>
<tbody>
<tr>...</tr>
<tr>...</tr>
</tbody>
</table>

</body>
</html>

Syntax 1: Valid, tr nested within thead, tfoot, tbody : allowed; td, th nested within tr: allowed
Syntax 2: Valid, tr nested within table: allowed because tbody absent; td nested within tr: allowed
Syntax 3: Invalid, tr nested within head, body: not allowed; tr nested within table: not allowed because tbody is present (tr should be nested within tbody in this case)

tr intro tr optional, occurrences tr browser display tr syntax