HTML and CSS Reference
In-Depth Information
1.
After any
caption
,
colgroup
, and
thead
elements but before any
tbody
or
tr
elements, or
2.
After any
caption
,
colgroup
,
thead
,
tbody
, and
tr
elements.
In either of the above cases, only one
tfoot
element is permitted per table. An example of the
tfoot
element placed in code before a
tbody
element is shown in Listing 7-16.
Listing 7-16.
A table demonstrating an alternative placement of the
tfoot
element
<table>
<thead>
<tr>
<th scope="col">Product</th>
<th scope="col">Quantity</th>
</tr>
</thead>
<tfoot>
<tr>
<th scope="row">Totals</th>
<td>659</td>
</tr>
</tfoot>
<tbody>
<tr>
<th scope="row">Utility Belts</th>
<td>9</td>
</tr>
<tr>
<th scope="row">Grappling Hooks</th>
<td>27</td>
</tr>
<tr>
<th scope="row">Smoke Pellets</th>
<td>623</td>
</tr>
</tbody>
</table>
Figure 7-7 shows the output of the code from Listing 7-16. As you can see, the table renders exactly the
same as the code used in Listing 7-15 and shown in Figure 7-6. A
tfoot
element will always be rendered
at the bottom of the table to which it belongs.
Figure 7-7.
Browser output of a table with a table footer row group