HTML · Lesson 7 of 9
Tables
Rows, cells, headers and captions for tabular data.
Use tables for data, not for page layout.
<table>wraps the table,<tr>is a row.<th>is a header cell,<td>a data cell.<thead>,<tbody>and<tfoot>group rows.<caption>titles the table;colspan/rowspanmerge cells.
Try it yourself
Edit the code and press Run (or Ctrl/⌘ + Enter). Code runs only in your browser, in a sandbox.
Key points
- Tables are for data.
- <th> for headers helps accessibility.
- colspan/rowspan merge cells.
Quick check
Which element is a header cell?
<th> marks a header cell; <thead> is the group of header rows.
Practice task
Build a table of three companies with columns for name, location and number of openings, including a caption and a header row.
Interview corner
Why shouldn't tables be used for page layout?
They mix structure with presentation, are hard to make responsive and confuse screen readers. Use CSS Grid/Flexbox for layout.
What does scope="col" on <th> do?
It tells assistive technology that the header applies to the cells in that column.
Further reading
Official documentation, linked for deeper study. These are outside sites; this lesson's text is our own.
Original lesson written by the InfoparkDaily team · © 2026 InfoparkDaily · Free to learn — no paid course or subscription.