Tables (table, tr, td, th), online

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

Tables (table, tr, td, th) in one minute

What students need to know

The two <th> cells label the Product and Price columns. They are bold and centred by default without any CSS. The two <td> cells are inside a <tr>, which is inside <table>. This correct nesting is required for valid HTML tables.

<tr> (table row) creates a horizontal row. Each cell - <td> or <th> - sits inside a <tr>. HTML tag names must be lowercase. <TABLE> is non-standard - use <table>.

Mistakes students make

  • HTML tag names must be lowercase. <TABLE> should be written as <table>.
  • HTML tag names must be lowercase. <TD> and </TD> should be written as <td> and </td>.
  • HTML tag names must be lowercase. <TR> and </TR> should be written as <tr> and </tr>.
  • Each row's cells must be wrapped inside a <tr> element. The cells for Bob are missing their enclosing <tr></tr> tags.

Discover other journeys with this module

What students will learn in this module

Every question in Module 24

Quick questions

  1. Which element wraps the entire table?A<tr>B<table>
  2. Which element creates a single row inside a table?A<tr>B<td>
  3. What is the difference between <td> and <th>?A<th> is a header cell, bold by default; <td> is a data cellB<th> is for tables; <td> is for div containers
  4. True or false: <td> cells can be placed directly inside <table> without a <tr>.ATrueBFalse
  5. True or false: <TABLE> with capital letters is valid HTML.AFalseBTrue

Key terms

Students type the meaning of:

  • <tr>

Match the pairs

<table>
  <tr><th>Name</th><th>Age</th></tr>
  <tr><td>Alice</td><td>25</td></tr>
</table>
Match it to what it does
<tr><td>Sydney</td><td>5m</td></tr>Match it to what it does
<th> creates a header cell - bold and centred by default, used for column or row labelsMatch it to what it does
Every <td> and <th> must be inside a <tr>, and every <tr> must be inside <table>Match it to what it does
<table>
  <td>Name</td>
  <td>Score</td>
</table>
Match it to what it does
<TABLE>
  <TR><TH>Name</TH></TR>
</TABLE>
Match it to what it does

Fill in the blanks

  1. <___>
      <tr><td>Data</td></tr>
    </table>

    Hint: Type the element name that creates a table

  2. <table>
      <___><th>Name</th></tr>
    </table>

    Hint: Type the element name that creates a table row

  3. <table>
      <tr><___>Score</th></tr>
    </table>

    Hint: Type the element name for a table header cell

  4. <table>
      <tr><___>Alice</td></tr>
    </table>

    Hint: Type the element name for a standard table data cell

  5. <table>
      <tr><th>City</th></tr>
      <tr><td>Sydney</td></tr>
    </___>

    Hint: Type the element name for the closing tag that ends the table

Spot the error

Question 1

A<TABLE>B  <tr><th>Name</th><th>Age</th></tr>C  <tr><td>Alice</td><td>25</td></tr>D</table>

Question 2

A<table>B  <tr><TD>Name</TD><TD>Score</TD></tr>C  <tr><td>Alice</td><td>95</td></tr>D</table>

Question 3

A<table>B  <tr><th>Item</th><th>Price</th></tr>C  <TR><td>Apple</td><td>$1</td></TR>D</table>

Question 4

A<table>B  <tr><th>Name</th><th>Age</th></tr>C  <tr><td>Alice</td><td>25</td></tr>D  <td>Bob</td><td>30</td>E</table>

Question 5

A<table>B  <tr>C    <th>Product</th>D    <th>Price</th>E  <tr>F</table>