Loading learning progress…
HTML-06-02 · LESSON 2 / 4 · ± 9 MINUTES
Rows & Cells
After this lesson, you can write table rows, header cells, and data cells in a consistent arrangement.
BEGIN WITH A QUESTION
Understanding begins with a question.
The number ‘12’ says little on its own. In the ‘Science’ row and ‘Book count’ column, it gains meaning.
Write table rows, header cells, and data cells in a consistent arrangement.

UNDERSTAND THE CONCEPT
Table → tr → cells
Table wraps the table. Tr wraps one row. Th is a header cell; td is a data cell. Th and td belong inside tr, rather than directly inside table. In a simple table, every row has the same number of columns.
A header is also a cell
The first row can contain th for column names. Subsequent rows contain data, and their first cell can also be th if it names the row. Th provides header meaning, beyond bold text.
The browser may add tbody
When parsing tr directly inside table, the browser may add tbody to the document structure. This is an example of HTML recovery or completion. In the next lesson, you will write row groups explicitly for clarity.
EXAMPLE / CONTEXT
Examples clarify concepts.
HTML EXAMPLE
<table>
<tr><th scope="col">Category</th><th scope="col">Book count</th></tr>
<tr><th scope="row">Science</th><td>12</td></tr>
<tr><th scope="row">Stories</th><td>18</td></tr>
</table>BROWSER RESULT
Each row has two cells. The Science and Stories headers name rows; the numbers in td are sample data.
TRY TOGETHER
Practice clarifies understanding.
<><th scope="row">Science</th><td>12</td></tr>Show a hint
Short for table row.
Try as often as you need. The independent task that follows records lesson completion.
WRITE · OBSERVE · UNDERSTAND
Record garden seedlings
Create a two-column table: Plant and Pot count. Use th for column headings, then at least three plant data rows with cells inside tr.
Editor shortcuts & help
- Ctrl + Space
- Show suggestions · ↑ ↓ select · Enter accept · Esc close
- Shift + Alt + F
- Format code
- Ctrl/⌘ + F
- Find and replace text
- Ctrl/⌘ + [ / ]
- Decrease / increase indentation
- Tab
- Move focus; inside a snippet, move to the next field. Esc then Tab to exit.
- Ctrl/⌘ + Z
- Undo changes, including formatting
Suggestions use the language, snippets, and local code context. Formatting runs in your browser.
Ctrl/⌘ + Enter runs the preview. Preview uses reading styles. Scripts and form submission are disabled. Sample illustration: assets/observatory.svg.
STEP-BY-STEP HINTS
- Create the header row first.
- Data pattern: <tr><th scope="row">Chili</th><td>3</td></tr>. Use other plants and numbers.
TAKE THIS UNDERSTANDING WITH YOU
Practice gives a foundation.
- Tr wraps a row; th and td wrap cells.
- Th is a header cell; td is a data cell.
- Simple tables keep their column count consistent.
A lesson is complete when the independent task meets its goals. Return to the reading at any time.
Next lesson →
Skip to content