×

html · level 2 · unit 3 · lesson 2

  1. meet it
  2. guess first
  3. your turn
  4. fix it
  5. nailed it

Tap a green word if you get lost.

meet it

<thead>, <tbody> and <tfoot> split a table into parts.

Bigger tables have parts. <thead> is the : the row of column names. <tbody> is the : the facts. <tfoot> is the : totals or notes at the bottom.

Each part holds whole rows. Screen readers use the parts to tell names from facts, and some browsers repeat the head at the top of every printed page.

Leave <tbody> out and the browser quietly adds one around your rows, so every table has a body anyway.

<table>
  <caption>Camping kit</caption>
  <thead>
    <tr><th>Item</th><th>Price</th></tr>
  </thead>
  <tbody>
    <tr><td>Tent</td><td>£60</td></tr>
    <tr><td>Torch</td><td>£8</td></tr>
  </tbody>
  <tfoot>
    <tr><td>Total</td><td>£68</td></tr>
  </tfoot>
</table>

Press show my page to see it here.

The order inside a table is always caption, head, body, then foot.