Skip to article content
FrontendXLesson 05 / 30

Lists, tables and data semantics

Build semantic, accessible and responsive interfaces from a blank page, and explain why each layout and styling decision works.

beginner · about 30 minutes · 1 exercises

  • Implement

What you will be able to do

#
  • Use list elements for navigation and grouped content.
  • Build a data table with caption, header cells and correct header scope.

Overview

#

Lists carry structure that screen readers announce, including the item count. Navigation menus are lists of links. Steps are an ordered list. A group of related items is an unordered list. Marking these up as divs throws away the count and the grouping.

Data tables are for data, not layout. A table needs a <caption> that names it, <th> cells for headers, and a scope attribute so assistive technology can associate each header with its cells. Column headers use scope="col" and row headers use scope="row".

snippet.html
<table>
  <caption>Quarterly revenue (thousands)</caption>
  <thead>
    <tr>
      <th scope="col">Quarter</th>
      <th scope="col">Revenue</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th scope="row">Q1</th>
      <td>12</td>
    </tr>
    <tr>
      <th scope="row">Q2</th>
      <td>19</td>
    </tr>
  </tbody>
</table>

Never use a table to position page regions. Layout tables break the reading order and confuse the table navigation commands that screen reader users rely on. If you need a grid of boxes, use CSS Grid on divs, and reserve tables for tabular data.

Exercises

#

Reference answers and expected output are authored, not executed in this browser. Nothing you type is run, and there is no Run or Pass control on this page.

  1. Exercise 1Implement

    Build a data table with a caption 'Monthly active users', a column header row of Month and Users, and two data rows where the month is a row header.

    starter.html
    <table>
      <!-- build the table -->
    </table>

    Reveal the reference answer
    reference.html
    <table>
      <caption>Monthly active users</caption>
      <thead>
        <tr>
          <th scope="col">Month</th>
          <th scope="col">Users</th>
        </tr>
      </thead>
      <tbody>
        <tr>
          <th scope="row">October</th>
          <td>4100</td>
        </tr>
        <tr>
          <th scope="row">November</th>
          <td>4600</td>
        </tr>
      </tbody>
    </table>

    Authored expected output: A table with a caption, a thead of two column headers, and a tbody where each row begins with a row header.

    The caption names the table and scope tells assistive technology which cells each header describes.

Common misconceptions

#
  • Tables are acceptable for page layout if they look right.
  • th cells do not need scope because position implies the relationship.

Follow-up practice

#
  • html-css-06-form-anatomy

Related resources

#

Your progress

#

Answers, drafts and completion marks are stored only in this browser. Nothing is sent to a server and no account is used.

Verification: authored. Answers and outputs on this page are authored reference material, not executed results.

© 2026 FrontendX. All rights reserved.