Lesson 55 of 55
HTMLTables
10 min
Course progress100%
What you'll learn
Keep these ideas in mind as you work through the lesson.
Lesson 55 of 55
HTML10 min
Keep these ideas in mind as you work through the lesson.
<table>)<table>
<caption>Quarterly Sales</caption>
<thead>
<tr>
<th scope='col'>Region</th>
<th scope='col'>Q1</th>
<th scope='col'>Q2</th>
</tr>
</thead>
<tbody>
<tr>
<th scope='row'>North America</th>
<td>1200</td>
<td>1300</td>
</tr>
<tr>
<th scope='row'>Europe</th>
<td>900</td>
<td>950</td>
</tr>
</tbody>
</table>
<caption> – Provides a textual description for screen readers and improves SEO.<thead>, <tbody>, <tfoot> – Group rows semantically; aids screen‑reader navigation.scope – Clarifies whether a <th> labels a column (col) or a row (row).colspan, rowspan – Merge cells when needed (e.g., for section headers).<caption>.scope or id/headers attributes for complex tables.overflow-x:auto to allow horizontal scrolling without breaking the layout..responsive-table {
width: 100%;
border-collapse: collapse;
overflow-x:auto;
}
Apply the class to the <table> element to create a scrollable table on small screens.
Tip: Test your tables with a screen reader (e.g., NVDA) to verify that headings are announced correctly and that the table is navigable.
<caption> present and descriptive? ✅<th> elements include scope attribute? ✅border="1")? ✅id/headers for cell relationships? ✅If any answer is “no”, adjust the markup accordingly.