A timetable compares times and days, so both row and column headers are useful. Readers should always know which day and time a class belongs to. Before writing the code, picture the information as a small grid. Each label should help a reader understand the value next to it.
What You Need to Know
Use unambiguous time formats and explain abbreviations if they are unfamiliar. Complex schedules may require extra header associations.
Read a table like a story about data. The caption says what you are looking at; row and column headers explain what the numbers or words mean.
Example: See It in Action
Here is a simple example to experiment with. Type it, save the file, and check what the browser displays.
This is a short HTML fragment. To try it as a webpage, put it inside the body element of a complete HTML document.
<table>
<caption>Class timetable</caption>
<tr>
<th scope="col">Time</th>
<th scope="col">Mon</th>
<th scope="col">Tue</th>
</tr>
<tr>
<th scope="row">09:00</th>
<td>Math</td>
<td>Science</td>
</tr>
</table>
Let’s Understand the Example
- Table represents information whose row and column relationships matter.
- Caption gives the whole data table a clear name.
- Scope explains which table row, column or group a th cell labels.
Look at a data cell and ask: “What row and column does this value belong to?” The header elements help answer that question, including for people who navigate the table with a screen reader.
What Should You See?
You should see a grid for “Class timetable”, with headers such as “Time”, “Mon”, “Tue”. The browser displays cells, but meaningful table markup also helps readers connect each cell to its labels.
Read the first data row aloud together with its column labels. If you cannot explain a value without pointing to its position on screen, strengthen the headers.
Try It Yourself
- Add an afternoon time slot and a second class.
- Save your changes, open or refresh the page, and compare the result with the original example.
- Tell a friend what your change did. If you are not sure, undo it, refresh the page, and compare.
Common Beginner Mistakes
- Relying on colored cell backgrounds to show the day without text headers.
- Do not replace actual header cells with bold ordinary cells. Header markup is part of the meaning, not just the appearance.
Key Takeaways
- A timetable compares times and days, so both row and column headers are useful.
- Table represents information whose row and column relationships matter.
- Use unambiguous time formats and explain abbreviations if they are unfamiliar. Complex schedules may require extra header associations.