HTML Foundations

Lesson 5 of 6

Tables and Accessibility

Tables

HTML tables are for tabular data, rows and columns of related values, not for page layout (that job belongs to CSS).

HTML

<thead> groups the header row, <tbody> groups the data rows, and each <th> (header cell) is announced by screen readers as a column label for every <td> (data cell) beneath it.

Why accessibility matters

Accessible HTML isn't an extra feature, it's what makes your site usable for people using screen readers, keyboard-only navigation, or voice control, and it usually makes the site better for everyone else too.

  • Use real buttons (<button>) and links (<a>) instead of <div onclick>, they come with keyboard support and screen-reader semantics for free.
  • Always give images meaningful alt text.
  • Keep a logical heading order (h1h2h3), don't skip levels.
  • Make sure interactive elements are reachable and usable with the Tab key alone.
HTML

TIP

A quick way to sanity-check accessibility: unplug your mouse and try to use the whole page with only Tab, Shift+Tab, and Enter. If you get stuck, so will some of your visitors.

📝 Tables & Accessibility Quiz

Passing score: 70%
  1. 1.What is the main reason to prefer <button> over a clickable <div> for actions?

  2. 2.HTML tables should be used for arranging general page layout, like columns of unrelated content.

  3. 3.The table element that groups the header row is <____>.