Tables & Accessibility
← HTML course — Chapter 5 of 5
Building tables the right way, and the accessibility fundamentals every page needs: alt text, labels, headings order, landmarks, and ARIA basics.
Your score — Tables & Accessibility
/ (%)
Learn more
These quizzes are based on tutorials published on this site. Go deeper on Tables & Accessibility:
Study guide
All 10 questions from this chapter, with every option, the correct answer, and the explanation. Expand an answer to review before you take the quiz above.
What is the only element you can place directly inside table (besides caption and table sections)?
Answer
Correct: tr (table row)
Tables are built row by row: table contains tr elements, and each tr holds td or th cells. caption describes the whole table and goes right after the opening table tag. div inside table is invalid structure.
When should you use th instead of td?
Answer
Correct: For header cells that label a row or column
th marks header cells — column titles in the first row or row labels in the first cell of a row. td is for data cells. Browsers bold th by default, but the point is semantic structure, not styling.
What do thead and tbody help with?
Answer
Correct: They group header rows and body rows for clearer structure and styling
thead wraps header rows, tbody wraps data rows — optional but useful on larger tables. tfoot exists for footer rows. They help browsers, CSS, and assistive tech understand which rows are headers vs data.
Where should caption appear?
Answer
Correct: Immediately after the opening table tag, before any rows
caption gives the table an accessible title — "Dogs age", "Quarterly sales", etc. It belongs right after table opens. Screen readers announce it with the table. Good for accessibility and clarity.
When is a table the wrong tool for layout?
Answer
Correct: When building a page layout or aligning unrelated content — use CSS Grid or Flexbox instead
Tables are for tabular data — spreadsheets, comparisons, schedules. In the 1990s people used tables for layout; today CSS Grid and Flexbox handle layout without the accessibility problems of fake grid tables.
What does scope="col" on a th indicate?
Answer
Correct: The header applies to cells in its column
scope tells assistive tech whether a th labels its column (col), its row (row), or a group. It helps screen readers associate data cells with the right header — especially important in complex tables.
Which heading structure follows accessibility best practices?
Answer
Correct: h1 for the page title, h2 for sections, h3 for subsections — no skipped levels
Headings form an outline — like a table of contents for screen readers. One h1 per page is typical; descend in order without skipping levels. Visual size is CSS; the level carries meaning.
Why prefer a button element over a div with onclick for an action?
Answer
Correct: button is keyboard-focusable, has a built-in role, and activates with Enter/Space by default
Native button already works with keyboard and assistive tech — focusable, announced as a button, activated with Enter or Space. A clickable div needs tabindex, role, and key handlers duplicated by hand.
What is the first rule of ARIA?
Answer
Correct: Prefer native HTML elements with built-in semantics before adding ARIA roles or attributes
If a native element already gives the semantics and behavior you need — button, nav, label, input — use it. ARIA fills gaps when HTML cannot, not as a replacement for good markup. No ARIA is better than wrong ARIA.
When is aria-label appropriate on an input?
Answer
Correct: When a visible label is impossible and you need an accessible name, such as a search box identified only by placeholder
aria-label provides an accessible name when visible text is not available — but visible labels are better when you can use them. It does not replace name for form submission or alt for images. Use it sparingly and intentionally.
About this course
This is a chapter of the free HTML quiz course. Answer each question, get immediate feedback with an explanation, and move on. Your progress is saved in your browser — nothing leaves your machine.