Command Palette

Search for a command to run...

Hectal
Back to the lesson: Topic 3.1 — Table Basics
HTML · Example 1 of 3

A first table

You never wrote <tbody>, but the browser added one. Delete the CSS tab to see a table's default look: no lines at all.

An HTML table is built row by row: <table> holds rows (<tr>), each row holds cells, and a cell is either a data cell (<td>) or a header cell (<th>) that labels other cells.

Change the code and press Run (Ctrl+Enter). Predict what will happen first, then break it on purpose and read what changes. Your edits are saved and match the lesson page.

Ready for more? This phase has 5 hands-on exercises with automatic checks.

Practice questions

Write the code in the editor, run it, then open the model answer to compare.

01

Build a 3-column table of three countries with their capital and continent, with a header row.

02

Make the country names row headers and add borders that show as single lines.

Explain it without notes

01

What is the difference between td and th, beyond how they look?

02

There is no column element in a basic table. How does a browser know which cells form a column?

03

What is foster parenting, and when does it happen?

04

When is a table the right choice for content?

A first table

Preview

Press Run to see the page.

Console

Nothing logged yet.

Expected console output

Rows: 4
Cells in row 1: 3
tbody elements added by the browser: 1