Course contentsShow
← Web Development
Lesson 1005 of 2,98218. Accessibility FundamentalsFree lesson

Table Structure: Caption, TH, and Scope

Understand how proper table markup enables screen readers to navigate and understand data relationships.

Table Structure: Caption, TH, and Scope

You'll learn how proper table markup helps screen readers navigate complex data tables and understand relationships between cells.

When you create an HTML table, you're not just arranging data visually—you're creating a structured grid that assistive technology needs to interpret. Without proper markup, a screen reader user hears a jumble of disconnected numbers and words with no context about which column or row they belong to.

Why Table Structure Matters

Imagine listening to a table read aloud cell-by-cell without being able to see it. How would you know what each number represents? Screen readers rely on specific HTML elements to announce context as users navigate through cells.

The Key Elements

<caption> describes what the entire table is about. It's announced first, giving users crucial context before they dive into the data:

<table>
  <caption>Monthly Sales by Region</caption>
  <!-- table content -->
</table>

<th> (table header) marks header cells that label columns or rows. Screen readers associate these headers with data cells, announcing them together:

<tr>
  <th>Region</th>
  <th>January</th>
  <th>February</th>
</tr>

The scope attribute explicitly tells assistive technology whether a header applies to a column (scope="col") or row (scope="row"):

<th scope="col">January</th>  <!-- This header is for the column below -->
<th scope="row">Northeast</th> <!-- This header is for the row beside it -->

When a screen reader lands on a data cell, it announces the associated headers: "Northeast, January, 45,000"insteadofjust"45,000" instead of just "45,000."

Key Takeaway: Use <caption> to describe tables, <th> to mark headers, and scope to define header relationships—these elements transform visual tables into navigable, understandable data structures for screen reader users.