HTML Reference ยท Tables
The <tfoot> element
Reference for the HTML <tfoot> element: grouping summary rows such as totals at the bottom of a table, where it goes in the source, and technical details.
The <tfoot> element groups the rows at the bottom of a <table> that summarize the columns: totals, averages, or notes that apply to the whole table. A table can have only one <tfoot>.
In modern HTML, <tfoot> goes after all the <tbody> elements (or rows), as the last part of the table. Browsers always draw it at the bottom.
<tfoot> <tr> <th scope="row">Total</th> <td>1,240</td> </tr> </tfoot>
Try it
Attributes
This element has no attributes of its own. It accepts the global attributes. The obsolete align, valign, char, charoff and bgcolor attributes should be replaced with CSS.
Usage notes
- Put it last. Older versions of HTML required
<tfoot>before<tbody>. That order is no longer valid; write it after the body so the source reads in the same order as the screen. - Label the summary. Start the footer row with a
<th scope="row">such as "Total" so screen reader users know what the numbers mean. - Not for page footers.
<tfoot>belongs to a table. For the footer of a page or article, use<footer>. - Printing. Browsers can repeat the footer rows at the bottom of each printed page of a long table.
- Scripting.
table.tFootreturns the element,table.createTFoot()returns or creates it, andtable.deleteTFoot()removes it.
Technical summary
| Content categories | None |
| Permitted content | Zero or more <tr> and script-supporting elements |
| Tag omission | The start tag is required. The end tag can be omitted if there is no more content in the parent element |
| Permitted parents | A <table>, after any <caption>, <colgroup>, <thead>, <tbody> and <tr> elements, and only if the table has no other <tfoot> |
| Implicit ARIA role | rowgroup |
| DOM interface | HTMLTableSectionElement |
| Default display | table-footer-group |
Browser support
Supported in every browser.
Related
<thead>โ the header rows<tbody>โ the body rows<table>โ the table itself- Lesson: Tables
- Lesson: Styling Tables with CSS