Does a table row (<tr>
) have to be in a table body (<tbody>
), if the table has a table body, or can it exist outside of the table body?
<table>
<tr>
<td colspan='2'>...</td>
</tr>
<tbody>
<tr>
<td>...</td>
<td>...</td>
</tr>
</tbody>
<tr>
<td colspan='2'>...</td>
</tr>
<tbody>
<tr>
<td>...</td>
<td>...</td>
</tr>
</tbody>
</table>
Contrary to what Terrill Thomson said, a table with <tr>
tags outside of the <thead>
, <tfoot>
and <tbody>
tags but inside the <table>
tags will validated against the W3C Markup Validation Service.
This document was successfully checked as HTML 4.01 Transitional:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="en">
<head>
</head>
<body>
<table>
<thead>
<th colspan="2">head1</th>
<th>head2</th>
</thead>
<tfoot>
<th colspan="2">foot1</th>
<th>foot2</th>
</tfoot>
<tr><td colspan="3">this row is outside of thead and tfoot</td></tr>
<tbody>
<tr>
<td>1-1</td>
<td>1-2</td>
<td>1-3</td>
</tr>
<tr>
<td>2-1</td>
<td>2-2</td>
<td>3-3</td>
</tr>
<tr>
<td>3-1</td>
<td>3-2</td>
<td>3-3</td>
</tr>
</tbody>
</body>
</html>
No, the <tr>
can be in the <thead>
, <tbody>
, <tfoot>
or it doesn't have to be in any of them.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With