Fix guides · Accessibility

How to fix data table headers (size charts, price and spec tables)

Tables whose header cells aren't connected to their data leave screen reader users hearing numbers without context. How to mark up size charts and comparison tables correctly.

Time to fix
15–30 minutes
Skill needed
Copy and paste
Who notices
Screen reader users

Why it matters

In a well-built table, a screen reader announces the column and row header with every cell: "Medium, Chest, 40 inches". That only works when header cells use <th> and are connected to the data cells.

Lighthouse flags headers that don't label any data cells, headers attributes that point at cells outside the table, and a summary that just repeats the caption.

“When tables are not marked up semantically and do not have the correct header structure, screen reader users cannot correctly perceive the relationships between the cells and their contents visually.”

Deque axe rule: th-has-data-cells (used by Lighthouse)

Before you start

  • Use <th scope="col"> for column headers and <th scope="row"> for row headers, and add a <caption> that says what the table is.
  • Don't use a table for layout. If you must, add role="presentation" so it isn't announced as a data table.
  • Remove empty header cells, or turn them into <td>.

Fix it on your platform

Shopify

  1. Shopify's theme accessibility guidance asks for <th> header cells with scope attributes and a <caption>.
  2. Size charts are often pasted into product descriptions or pages. Switch the rich text editor to its HTML view and change the header row cells to <th scope="col">.

WordPress

  1. In the Table block's settings, turn on the Header section so the first row becomes header cells, and add a caption.
  2. Tables from plugins (comparison tables, size charts) follow the plugin's settings; look for a header row option.

Webflow

  1. A "table" built from Div Blocks or a grid isn't announced as a table. For real data tables, use an Embed element with <table>, <th> and scope markup.

Wix Managed by the platform

  1. Wix's table elements are managed by Wix. If a table in custom code is listed, add <th> and scope in that code.

Squarespace Managed by the platform

  1. Squarespace's own tables are managed by Squarespace. If a table in a code block is listed, add <th> and scope in that code.

Next.js

  1. Render header cells as <th scope="col"> (or "row") and add a <caption>; it can be visually hidden if needed.

Any other site

  1. Mark header cells with <th> and scope, and add a caption.
Size chart
<table>
  <caption>Shirt sizes (inches)</caption>
  <tr><th scope="col">Size</th><th scope="col">Chest</th><th scope="col">Waist</th></tr>
  <tr><th scope="row">Medium</th><td>40</td><td>34</td></tr>
</table>

Check that it's fixed

  • Re-run your StudioLNC audit: the tables should no longer be listed.

Find every issue like this on your site

Free audit of performance, accessibility, SEO and security, with fixes for your platform.