<tfoot>
A table footer: rows with a summary, totals, or notes on the columns.
- Display
- table-footer-group
- Closing tag
- Required
- Permitted content
<tr>elements
Example
#<style>
table { border-collapse: collapse; }
th, td { border: 1px solid #8886; padding: 4px 10px; text-align: left; }
tfoot { font-weight: bold; }
</style>
<table>
<thead>
<tr><th scope="col">Lesson</th><th scope="col">Time</th></tr>
</thead>
<tbody>
<tr><td>Forms</td><td>15 min</td></tr>
<tr><td>Text fields</td><td>10 min</td></tr>
<tr><td>Buttons</td><td>8 min</td></tr>
</tbody>
<tfoot>
<tr><th scope="row">Total</th><td>33 min</td></tr>
</tfoot>
</table>Definition and usage
#The <tfoot> element contains rows that summarize the columns: totals, averages, total time. In the code you put it at the end of the table, after <tbody>.
The browser always draws the footer at the bottom of the table, and when printing a long table it may repeat it on every page, just like <thead>.
A table footer is not the place for information about the whole page. Only things that relate to the columns of that particular table belong there.
Syntax
#<tfoot>
<tr>…</tr>
</tfoot>Attributes
#This element has no attributes of its own. It supports the global attributes, such as class, id and hidden.
Default CSS
#Most browsers display this element with these default styles:
tfoot {
display: table-footer-group;
vertical-align: middle;
}Browser support
#Widely available
Works in all modern browsers, phones included. You can use it without worry.
- Chrome
- Edge
- Firefox
- Safari
Good practices
#- Write the cell with the summary label, for example “Total”, as
<th scope="row">. - A table can have only one
<tfoot>.
Related entries
#Spotted a mistake or missing an example? Write to us.