HTML <tfoot> Tag

Beginner
⏱️ 5 min read
📚 Updated: Jun 2026
🎯 3 Examples
Tables

What You’ll Learn

The <tfoot> tag groups footer rows in a table for totals, summaries, and metadata. This guide covers syntax, thead/tbody/tfoot structure, colspan, CSS styling, accessibility, and best practices for beginners.

01

Table Footer

Summary row group.

02

Totals

Grand totals & sums.

03

colspan

Span label cells.

04

Core Syntax

Inside table element.

05

Row Groups

thead, tbody, tfoot.

06

Best Practices

Semantic structure.

What Is the <tfoot> Tag?

The <tfoot> tag is an HTML element used inside <table> to define the footer section of a table. It groups rows that summarize or provide context for the data in tbody, such as totals, subtotals, or copyright notes.

Valid HTML5 — Table Row Group

tfoot wraps one or more tr elements with td or th cells. Pair it with thead and tbody for a complete semantic table.

Footer rows visually appear at the bottom of the table even when you write tfoot before tbody in HTML5. For readability, many developers still place tfoot after tbody in source order.

📝 Syntax

Place tfoot inside table with tr rows containing summary cells:

syntax.html
<table>
  <thead>
    <!-- Table header rows -->
  </thead>
  <tbody>
    <!-- Main data rows -->
  </tbody>
  <tfoot>
    <!-- Footer / summary rows -->
  </tfoot>
</table>

Total Sales Example

total-sales.html
<tfoot>
  <tr>
    <td colspan="2">Total Sales:</td>
    <td>$1,000,000</td>
  </tr>
</tfoot>

Syntax Rules

  • tfoot must be a direct child of table (along with caption, colgroup, thead, and tbody).
  • Only tr elements go directly inside tfoot.
  • Use colspan on footer cells to span label text across columns.
  • Use th in footer rows for summary labels like “Subtotal” or “Total”.
  • A table may contain at most one tfoot element.

⚡ Quick Reference

TopicCode SnippetNotes
Basic tfoot<tfoot>...</tfoot>Footer row group
Total rowcolspan="2" + valueSpan labels
Footer label<th>Subtotal</th>Summary header cell
Metadatacolspan="3" copyrightFull-width note
vs tbodytfoot = summarytbody = data
Browser supportUniversalAll browsers

⚖️ <thead>, <tbody>, and <tfoot>

ElementContainsTypical cells
<thead>Header rowsth column labels
<tbody>Main data rowstd data values
<tfoot>Footer / summary rowsTotals, metadata
Source ordertheadtbodytfootRecommended for clarity

🧰 Attributes

The <tfoot> tag has no tag-specific attributes. Use global attributes and colspan on child cells for layout.

attributes.html
<tfoot class="table-footer">
  <tr>
    <td colspan="2">Total:</td>
    <td>$100</td>
  </tr>
</tfoot>
class / id Global

Style all footer rows with a shared background or bold text.

class="table-footer"
colspan On td/th

Span footer label cells across multiple columns before a total value.

colspan="2"
th in tfoot Semantic

Use th for summary labels like Subtotal or Total.

<th>Total</th>
align / valign Obsolete

Deprecated presentational attributes. Use CSS on footer cells instead.

text-align: right

Examples Gallery

Table summaries, metadata footers, and subtotal rows with copy-ready code and live previews.

👀 Live Preview

Table with thead, tbody data, and a tfoot total row:

ProductUnitsRevenue
Widget A100$1,000
Widget B50$500
Total Sales:$1,500

📚 Common Use Cases

Use <tfoot> to summarize table data, display totals, and add metadata at the bottom of structured tables.

Providing Table Summaries

The tfoot tag is commonly used to show totals or other summary information about the data above:

providing-table-summaries.html
<table>
  <thead>
    <tr>
      <th>Product</th>
      <th>Units Sold</th>
      <th>Revenue</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>Product A</td>
      <td>500</td>
      <td>$500,000</td>
    </tr>
  </tbody>
  <tfoot>
    <tr>
      <td colspan="2">Total Sales:</td>
      <td>$1,000,000</td>
    </tr>
  </tfoot>
</table>
Try It Yourself

Adding Metadata

Include copyright or source notes in the table footer spanning all columns:

adding-metadata.html
<tfoot>
  <tr>
    <td colspan="3">&copy; 2026 Your Company Name. All rights reserved.</td>
  </tr>
</tfoot>
Try It Yourself

Subtotal Row with th

Use th cells in tfoot for summary labels like subtotals:

subtotal-row.html
<tfoot>
  <tr>
    <th colspan="2">Subtotal</th>
    <td>$15.00</td>
  </tr>
</tfoot>
Try It Yourself

♿ Accessibility

  • Use th for summary labels — Footer labels like “Total” or “Subtotal” belong in th cells for clearer semantics.
  • Pair tfoot with thead — Column headers in thead give context to footer totals.
  • Keep footer content relevant — Totals and summaries should relate directly to the tbody data.
  • Add a caption — A caption describes the whole table including its summary rows.
  • Keep tables for data — Do not use tfoot in layout tables; it confuses assistive technologies.

🧠 How <tfoot> Works

1

Author adds footer rows

Summary tr rows with totals or notes go inside tfoot.

Markup
2

Browser groups the footer

tfoot is treated as a distinct row group, rendered at the table bottom.

Structure
3

CSS styles the footer

Classes on tfoot add bold text, borders, or background emphasis.

Design
=

Clear table summaries

Totals and metadata are semantically grouped at the bottom of structured tables.

Browser Support

The <tfoot> tag is supported in all major browsers, including Internet Explorer.

Baseline · HTML4 / HTML5

Table footer everywhere

All browsers render <tfoot> as the standard table footer row group.

100% Core tag support
Google Chrome Fully supported
Full support
Mozilla Firefox Fully supported
Full support
Apple Safari Fully supported
Full support
Microsoft Edge Fully supported
Full support
Internet Explorer Fully supported · EOL
Full support
Opera Fully supported
Full support
<tfoot> tag 100% supported

Bottom line: Use <tfoot> confidently to group table footer rows in any browser.

Conclusion

The <tfoot> tag is essential for well-structured HTML tables. By grouping summary and footer rows separately from body data, you improve clarity, styling control, and semantic meaning in tabular content.

💡 Best Practices

✅ Do

  • Use tfoot for totals, subtotals, and relevant summaries
  • Use colspan to align label cells with data columns
  • Style tfoot with CSS for visual separation from body rows
  • Pair tfoot with thead and tbody for full structure

❌ Don’t

  • Put unrelated page footer content inside table tfoot
  • Use obsolete border or align attributes on tables
  • Duplicate every data row in tfoot without purpose
  • Use tables (and tfoot) for page layout

Key Takeaways

Knowledge Unlocked

Six truths every developer should know about <tfoot>

Bookmark these before you add footer rows to your next HTML table.

6
Core concepts
💰 02

Totals

Grand sums.

Use case
📑 03

colspan

Span labels.

Layout
⚖️ 04

vs tbody

Summary vs data.

Comparison
05

th Labels

Semantic totals.

A11y
🌐 06

100% Support

All browsers.

Compatibility

❓ Frequently Asked Questions

It groups footer rows in a table for totals, subtotals, averages, or metadata about the table data.
Write tfoot after tbody for clarity. HTML5 also allows tfoot before tbody; browsers still render it at the bottom.
tbody holds main data rows. tfoot holds summary or footer rows such as totals and copyright notes.
Yes. colspan on td or th cells is common to span label text across columns before a total value.
Yes. Full support in every major browser including Internet Explorer.

Add table footer summaries

Practice <tfoot> with totals, metadata, and colspan in the Try It editor.

Try total sales example →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

6 people found this page helpful