Put data in a table by writing it one row at a time, with the same number of cells in every row.
Timetables, sports results, price lists and school reports are tables: data in rows and columns.
Some information is a grid: rows going across, columns going down. HTML has no tag for a column. You write the table one row at a time and the columns appear.
Make your prediction first. Help opens once you've locked it in.
<table>
<tr>
<th>House</th>
<th>Points</th>
<th>Wins</th>
</tr>
<tr>
<td>Owls</td>
<td>12</td>
<td>4</td>
</tr>
</table>
Read the code. <table> holds the table, and <tr> and <th> and <td> are new. How will the six words be arranged?
Compare the page with your prediction. Boxes is on, so each row and each cell shows as a box. Switch it off when you are done.
| Code | What it does | Why |
|---|---|---|
<table> … </table> |
Holds the whole table | Everything in a table sits between these two tags |
<tr> … </tr> |
Makes one row, going across | tr is "table row". You write the table a row at a time |
<th>House</th> |
Makes a heading cell | th is "table heading". The browser makes it bold and centred |
<td>Owls</td> |
Makes an ordinary cell | td is "table data". The tag says what it is; the look is the browser's |
| three cells in each row | Make three columns | There is no column tag. A column is the cells in the same place in each row, so every row needs the same number of cells |
| no lines around the cells | The table has no grid | The browser draws none. Colours and text styles come from rules, as for any other tag |
<table>
<tr>
<th>House</th>
<th>Points</th>
<th>Wins</th>
</tr>
<tr>
<td>Owls</td>
<td>12</td>
<td>4</td>
</tr>
</table>
Put the scrambled lines in order.
Sam wrote the table a column at a time.
<table>
<tr><td>Owls</td></tr>
<tr><td>Hawks</td></tr>
<tr><td>12</td></tr>
<tr><td>9</td></tr>
</table>
One row in this table is broken.
Put the lines in order to make one row for the Kestrels: 7 points and 2 wins. One line is not needed.
The Hawks have no points, and their row is shorter than the others. Click the line that causes it.
Add the Kestrels, with 7 points.
Copy a whole row, from <tr> to </tr>, then change the words.

Add a Wins column: the Owls have 4, the Hawks 3 and the Kestrels 2.
A new column needs a heading cell in the first row.
Then every other row needs one more <td>.

Add a row for the Kestrels.
This ticks when your page has all of the above.
Add a Wins column.
This ticks when your page has all of the above.
The Owls row is already gold and linked.
<style>
th {
background-color: navy;
color: white;
}
.winner {
background-color: gold;
}
</style>
<table>
<tr>
<th>House</th>
<th>Points</th>
</tr>
<tr class="winner">
<td><a href="https://example.com/owls">Owls</a></td>
<td>12</td>
</tr>
<tr>
<td>Hawks</td>
<td>9</td>
</tr>
</table>
Make a table of your own: a timetable for two days, your sports results, or a list of games with their ratings. Give it a heading row and at least two rows of data.
Plan it first: what are the column headings? How many rows?
Build the heading row with <th>, then one row at a time with <td>. Count the cells in each row.

Make a table with a heading row and at least two rows of data.
This ticks when your page has all of the above.
Students build tables one row at a time with table, tr, th and td, and learn that every row needs the same number of cells. About 45 minutes.
Open the teacher guide: answers, solutions, slides and a worksheet.
Do the Make task yourself (about 5 minutes).
A table is built row by row: <tr> is a table row, <th> a heading cell and <td> an ordinary cell ("table data"). Columns are not written anywhere: they appear because every row has its cells in the same order. Students who think in columns, or in spreadsheets, often write all of one column first. Tables are for data; the look (lines, colours) comes from rules, and page layout is a later course.
Building a table row by row with the same number of cells in each. Have them count the cells per row before they look at the page.
Stretch: Add a caption with <caption>House points</caption> just after <table>, and a totals row at the bottom. Style the heading cells with a th rule.
Support: Give students the Modify starter and ask them only to copy the Hawks row and change it to the Kestrels.
Next lesson names the parts of a page with header, nav, main and footer. Tables also lead to data work: the same rows and columns are a spreadsheet, a CSV file, and later a list of lists in Python. Class idea: collect class data (favourite sport, pets) and publish it as a table.