Table Headers, Captions and Spans
Group rows with thead, tbody and tfoot, and add a caption to describe the table. Use th with scope="col" or scope="row" so screen readers know what each header covers.
colspan makes a cell stretch across columns and rowspan makes it stretch across rows.
Example
<table border="1" cellpadding="6">
<caption>Weekly scores</caption>
<thead>
<tr><th scope="col">Name</th><th scope="col" colspan="2">Scores</th></tr>
</thead>
<tbody>
<tr><td>Ada</td><td>90</td><td>95</td></tr>
<tr><td>Tunde</td><td>80</td><td>85</td></tr>
</tbody>
</table>Exercise
Make the cell span two columns.
<td ="2">Wide</td>
Quiz Test
These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.