← HTML Fundamentals
Semantic page layout · 15 MIN

Tables for tabular data

Tables for tabular data

Tables are for data with row and column relationships, not page layout. Use caption to name the table, th for headers, scope to identify header direction and thead/tbody to group rows. Keep tables simple where possible.

Try it yourself

Change the example, run it, and explain the result in your own words. Then create one variation of your own.

Key idea

Use the example as a starting point, not something to memorize. Practise, inspect the result and make small improvements.

Code example

<table>
<caption>Course schedule</caption>
<thead><tr><th scope="col">Day</th><th scope="col">Topic</th></tr></thead>
<tbody><tr><th scope="row">Monday</th><td>HTML</td></tr></tbody>
</table>