Skip to content

<tfoot> - Table Footer Element

Table Element

The <tfoot> element represents a set of rows summarizing or providing supplementary information about the columns of a table. It typically contains totals, summaries, footnotes, or other concluding information. Like <thead>, the <tfoot> provides semantic structure that helps browsers and assistive technologies understand the table’s organization.

Result
<table>
<caption>Table caption</caption>
<thead>
<!-- header rows -->
</thead>
<tfoot>
<tr>
<th scope="row">Total</th>
<td>Sum value</td>
</tr>
</tfoot>
<tbody>
<!-- data rows -->
</tbody>
</table>

The <tfoot> element should appear in this specific order:

  1. <caption> (optional)
  2. <colgroup> (optional)
  3. <thead> (optional)
  4. <tfoot> (optional)
  5. <tbody> (one or more)

The <tfoot> element supports all global HTML attributes.

Result
Result
Result

Semantic Clarity

Clearly indicates which rows contain summary or supplementary information.

Printing

Browsers can repeat the footer on each printed page for long tables.

Accessibility

Screen readers can identify and announce footer content appropriately.

Styling

Apply consistent styles to footer rows with a single CSS selector.

Fixed Footers

Create sticky footers that remain visible while scrolling.

Data Integrity

Keeps summaries and totals structurally separate from raw data.

Result
Result
Result

Create a footer that stays visible while scrolling:

Result

Always use scope="row" for header cells in the footer:

<tfoot>
<tr>
<th scope="row">Total</th>
<td>$500</td>
<td>$600</td>
</tr>
</tfoot>

Make sure footer content is self-explanatory:

<tfoot>
<tr>
<th scope="row">Grand Total (All Categories)</th>
<td>$15,420</td>
</tr>
</tfoot>
<tfoot>
<tr>
<th scope="row">Subtotal</th>
<td>$100.00</td>
</tr>
<tr>
<th scope="row">Shipping</th>
<td>$10.00</td>
</tr>
<tr>
<th scope="row">Tax</th>
<td>$9.00</td>
</tr>
<tr class="total">
<th scope="row">Total</th>
<td>$119.00</td>
</tr>
</tfoot>
<tfoot>
<tr>
<th scope="row">Mean</th>
<td>85.3</td>
</tr>
<tr>
<th scope="row">Median</th>
<td>87.0</td>
</tr>
<tr>
<th scope="row">Std. Deviation</th>
<td>8.2</td>
</tr>
</tfoot>
<tfoot>
<tr>
<td colspan="3">
<p><strong>Notes:</strong></p>
<ul>
<li>All prices in USD</li>
<li>Shipping not included</li>
<li>Prices subject to change</li>
</ul>
</td>
</tr>
</tfoot>
/* Basic tfoot styling */
tfoot {
background-color: #f8f9fa;
font-weight: bold;
border-top: 2px solid #333;
}
/* Bold totals */
tfoot {
font-weight: 700;
font-size: 1.1em;
}
/* Gradient footer */
tfoot {
background: linear-gradient(to right, #4facfe, #00f2fe);
color: white;
}
/* Multiple row differentiation */
tfoot tr:last-child {
background-color: #2c3e50;
color: white;
font-size: 1.2em;
}
/* Fixed footer */
tfoot {
position: sticky;
bottom: 0;
background-color: #fff;
z-index: 10;
box-shadow: 0 -2px 4px rgba(0,0,0,0.1);
}
/* Separation from tbody */
tfoot {
border-top: 3px double #333;
}

For long tables that span multiple pages when printed:

@media print {
thead {
display: table-header-group;
}
tfoot {
display: table-footer-group;
}
tbody {
display: table-row-group;
}
}
  • Use for summaries and totals - perfect for aggregated data
  • Place before <tbody> in HTML source code
  • Use <th> with scope="row" for footer labels
  • Keep styling consistent with the rest of the table
  • Provide clear context for summary information
  • Consider multiple rows for complex summaries
  • Don’t use for non-summary content - keep it relevant to the data
  • Don’t omit for financial tables - totals are important
  • Don’t use deprecated attributes - use CSS instead
  • Don’t make it visually identical to tbody - differentiate it
  • Don’t forget accessibility - use proper scope attributes

Financial Data

Perfect for displaying totals, subtotals, and grand totals in financial tables.

Statistical Tables

Show averages, medians, or other statistical summaries.

Footnotes

Add explanatory notes, disclaimers, or data source information.

Multi-page Tables

Repeat summary information on each printed page.

The <tfoot> element is supported in all browsers:

  • ✅ Chrome (all versions)
  • ✅ Firefox (all versions)
  • ✅ Safari (all versions)
  • ✅ Edge (all versions)
  • ✅ Opera (all versions)
  • ✅ Internet Explorer (all versions)