Tables with <tfoot>
The complete table model has three section elements: <thead> (header rows), <tbody> (data rows — can appear multiple times), and <tfoot> (footer rows, shown at the bottom). <tfoot> is ideal for totals, averages, or summary rows.
Quarterly Sales Report
| Region | Q1 | Q2 | Q3 | Q4 | Annual Total |
|---|---|---|---|---|---|
| North America | $12.4M | $14.1M | $13.8M | $16.2M | $56.5M |
| Europe | $9.7M | $10.2M | $11.5M | $12.8M | $44.2M |
| Asia-Pacific | $18.3M | $21.0M | $24.7M | $28.3M | $92.3M |
| Latin America | $4.2M | $4.8M | $5.1M | $5.7M | $19.8M |
| Grand Total | $44.6M | $50.1M | $55.1M | $63.0M | $212.8M |
| Average per region | $53.2M | ||||
Order Summary with <tfoot>
| Item | Qty | Price | Subtotal |
|---|---|---|---|
| Wireless Headphones | 1 | $149.00 | $149.00 |
| USB-C Cable 2m | 3 | $12.99 | $38.97 |
| Portable Charger | 1 | $69.00 | $69.00 |
| Subtotal | $256.97 | ||
| Shipping | $9.99 | ||
| Tax (8%) | $21.36 | ||
| Total | $288.32 | ||
The footer rows in <tfoot> are visually at the bottom but can be declared before <tbody> in the source — browsers render it at the bottom regardless. This is helpful if you want to print header and footer on every page of a long table.