← HTML tutorial

HTML

Tables

A <table> is built from rows (<tr>), and each row holds cells, either regular data cells (<td>) or header cells (<th>), which browsers usually bold and center automatically.

Example: a simple data table

<table border="1" cellpadding="6">
  <tr>
    <th>Name</th>
    <th>Track</th>
  </tr>
  <tr>
    <td>Ada</td>
    <td>Frontend</td>
  </tr>
  <tr>
    <td>Chidi</td>
    <td>Cybersecurity</td>
  </tr>
</table>

The first row uses <th> for column headers; every row after it uses <td> for the actual data. Screen readers use these header cells to announce which column a value belongs to as they read across a row, a real, functional reason to use <th> correctly, not just for the bold styling.

One firm rule worth knowing early: tables are for tabular data, things that genuinely have rows and columns, like a schedule or a price list. Using a table to lay out an entire page (sidebar in one cell, content in another) was common in the 1990s and is considered broken practice today, that's what CSS layout tools like Flexbox and Grid exist for.

Try it yourself
Ready to go further?

These free tutorials are a preview, our Frontend Development cohort covers it in depth, with a real project and a cohort alongside you. Active

Enroll in Frontend Development
Don't miss out

Ready to build something real?

Create a free account to enroll in a track, and get notified the moment a cohort opens.

Create free account