Reputation: 65
I know how to achieve this kind of table with rowspan
for td
in the first column, but I'm wondering what is the best semantic approach to this.
Should I maybe create 3 tables (as this site has) and use main sections as heads of those, like this:
<th scope="col">Section 1</th>
Upvotes: 2
Views: 412
Reputation: 78850
It looks like you're pretty close. For a row-level header, you'll want to use scope="row"
instead. Unfortunately, there doesn't seem to be any way to make a <thead>
that is vertical:
<table>
<tbody>
<tr>
<th scope="row" rowspan="2">Section 1</th>
<td>Subsection 1A</td>
<td>Content of subsection 1A</td>
</tr>
<tr>
<td>Subsection 1B</td>
<td>Content of subsection 1B</td>
</tr>
<!-- etc -->
</tbody>
</table>
Upvotes: 2