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.
What students will learn in this module
Every question in Module 24
Quick questions
- Which element wraps the entire table?A<tr>B<table>
- Which element creates a single row inside a table?A<tr>B<td>
- 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
- True or false: <td> cells can be placed directly inside <table> without a <tr>.ATrueBFalse
- 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 doesEvery <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
<___> <tr><td>Data</td></tr> </table>
Hint: Type the element name that creates a table
<table> <___><th>Name</th></tr> </table>
Hint: Type the element name that creates a table row
<table> <tr><___>Score</th></tr> </table>
Hint: Type the element name for a table header cell
<table> <tr><___>Alice</td></tr> </table>
Hint: Type the element name for a standard table data cell
<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>
