Table sections (thead, tbody, caption), online

Six activities your students do on their own devices. See who's finished, and their scores.

Table sections (thead, tbody, caption) in one minute

What students need to know

<caption> is a direct child of <table>, appearing before the section elements. It renders as a visible label above the table. <thead> is the section wrapper for header rows. <th> is an individual header cell inside a <tr> inside <thead>.

HTML tag names must be lowercase. <TBODY> is non-standard - use <tbody>. <tbody> is optional - browsers add it implicitly if omitted. However, writing it explicitly improves readability and CSS targeting.

Mistakes students make

  • HTML tag names must be lowercase. <THEAD> should be written as <thead>.
  • The <tbody> opening tag is missing its closing </tbody> tag before </table>. Each section element must be properly closed.
  • The <td> cell is missing its enclosing <tr> and <tbody> wrapper. It should be <tbody><tr><td>Alice</td></tr></tbody>.
  • HTML tag names must be lowercase. <TBODY> should be written as <tbody>.
PREVIOUS · MODULE 24Tables (table, tr, td, th)
YOU ARE HERE · MODULE 25Table sections (thead, tbody, caption)
NEXT · MODULE 26The form element

Discover other journeys with this module

What students will learn in this module

Every question in Module 25

Quick questions

  1. Which element provides a visible title for an HTML table?A<caption>B<title>
  2. Which element groups the header rows of a table?A<thead>B<th>
  3. Where must <caption> be placed in a table?AInside a <thead> rowBDirectly inside <table>, before <thead>
  4. True or false: <TBODY> with capital letters is valid HTML.AFalseBTrue
  5. True or false: <tbody> must be explicitly written in every table.ATrueBFalse

Key terms

Students type the meaning of:

  • <tbody>

Match the pairs

<table>
  <caption>Monthly Sales</caption>
  <tbody><tr><td>Jan</td></tr></tbody>
</table>
Match it to what it does
<table>
  <thead><tr><th>Name</th></tr></thead>
  <tbody><tr><td>Alice</td></tr></tbody>
</table>
Match it to what it does
<caption> provides a visible title placed directly inside <table>Match it to what it does
<thead> groups header rows and <tbody> groups data rows - both sit directly inside <table>Match it to what it does
<table>
  <THEAD><tr><th>Name</th></tr></THEAD>
  <tbody><tr><td>Alice</td></tr></tbody>
</table>
Match it to what it does
<table>
  <td>Alice</td>
  <td>95</td>
</table>
Match it to what it does

Fill in the blanks

  1. <table>
      <___>
        <tr><th>Name</th></tr>
      </thead>
    </table>

    Hint: Type the element that wraps the header rows of a table

  2. <table>
      <___>
        <tr><td>Alice</td></tr>
      </tbody>
    </table>

    Hint: Type the element that wraps the body rows of a table

  3. <table>
      <___>Monthly Sales</caption>
      <tbody><tr><td>Jan</td></tr></tbody>
    </table>

    Hint: Type the element that provides a visible title above a table

  4. <table>
      <thead>
        <tr><th>Score</th></tr>
      </___>
    </table>

    Hint: Type the element name for the closing tag of the table header section

  5. <table>
      <caption>Results</caption>
      <thead><tr><th>Name</th></tr></thead>
      <tbody><tr><td>Alice</td></tr></___>
    </table>

    Hint: Type the element name for the closing tag of the table body section

Spot the error

Question 1

A<THEAD>B  <tr><th>Name</th><th>Score</th></tr>C</thead>D<tbody>E  <tr><td>Alice</td><td>95</td></tr>F</tbody>

Question 2

A<table>B  <tbody>C  <tr><td>Row data</td></tr>D</table>

Question 3

A<table>B  <caption>Monthly Sales</caption>C  <Thead>D    <tr><th>Month</th><th>Total</th></tr>E  </thead>F</table>

Question 4

A<table>B  <caption>Results</caption>C  <thead><tr><th>Name</th></tr></thead>D  <td>Alice</td>E  </tbody>F</table>

Question 5

A<table>B  <thead>C    <tr><th>Product</th></tr>D  </thead>E  <TBODY>F  </tbody>