Essential storage keeps sign-in and learning features working. Google Analytics measures visits; Microsoft Clarity records interactions to help us improve usability. Both are optional and stay off until you choose. Read our privacy policy.
Build an accessible workshop table coding exercise | SovranCode
Study the question, then follow the complete answer and its reasoning.
01 · QUESTION
What should the HTML contain?
Mark up a two-day workshop schedule so its purpose, column headers, and row headers remain clear outside the visual grid.
Requirements
Add a descriptive caption
Separate headers and data with thead and tbody
Use three th elements with scope=col
Use th with scope=row for Monday and Tuesday
Keep session values in td elements
Key idea
Use caption for the table's purpose, scope=col across the top, and scope=row for the first cell of each data row.
02 · SOLUTION
Complete HTML answer
<main>
<h1>Workshop schedule</h1>
<table>
<caption>HTML workshop sessions by day and time</caption>
<thead>
<tr>
<th scope="col">Day</th>
<th scope="col">Morning</th>
<th scope="col">Afternoon</th>
</tr>
</thead>
<tbody>
<tr><th scope="row">Monday</th><td>Documents</td><td>Headings</td></tr>
<tr><th scope="row">Tuesday</th><td>Tables</td><td>Forms</td></tr>
</tbody>
</table>
</main>
03 · EXPLANATION
Why this solution works
caption names the data set. thead and tbody identify structural groups. Each scoped th explicitly tells assistive technology whether it labels a column or a row, so a value such as Forms can be understood as Tuesday afternoon.
Concepts demonstrated
Distinguish data tables from layout
Associate headers with data cells
Write a useful table caption
Why this pattern matters
A visual grid is easy to scan when every row and column stays on screen, but that relationship can disappear for screen-reader users or on narrow displays. Captions, structural row groups, and scoped headers make every session value understandable in the context of its day and time.
Solution walkthrough
The caption gives the complete data set a concise, visible name.
The thead isolates the row that labels all three columns, while tbody contains schedule entries.
Each top header uses scope=col to identify the cells beneath it.
Monday and Tuesday use th with scope=row, so they label the session cells beside them.
Common mistakes to avoid
Using tables to position page layout
Making every cell td and relying on bold styling for headers
Leaving a vague or empty caption that does not identify the data
EXERCISE FAQ
Before you move on.
What does “Build an accessible workshop table” teach?
This intermediate HTML exercise focuses on Distinguish data tables from layout, Associate headers with data cells, Write a useful table caption. Its requirements define the exact behavior to implement before you write code.
How should I validate this HTML solution?
Start with the displayed example input and expected output, then test a boundary case suggested by the requirements. Edit the HTML, inspect the live preview, then run the checks before comparing your structure with the complete answer.
When should I open the reference solution?
Attempt Build an accessible workshop table first. Then open the read-only solution file to compare the contract, edge-case handling, and implementation choices—not simply to copy the final code.