What is the correct region value used for the HTML <th> table cell, than spans multiple columns?
Let's say you have an HTML table with a cell <th>that spans multiple columns, for example.
<table>
<tr>
<th colspan="3" scope="?">Scores</th>
<!-- ...more headings here... -->
</tr>
<tr>
<th scope="col">English</th>
<th scope="col">Maths</th>
<th scope="col">Science</th>
<!-- ...more sub-headings here... -->
</tr>
<tr>
<td>12</td>
<td>16</td>
<td>20</td>
<!-- ...more cells here... -->
</tr>
</table>
What is the correct scope attribute value for the spanning header cell? colseems to be incorrect, since its title is several columns, but colgroupdoest seems to be correct if in fact I have no tags colgroup.
+5
3 answers
WebAIM (Web Accessibility in Mind) . , , .
, , id/headers scope. , , -, JAWS, .
id/headers:
<table>
<tr>
<th id="scores" colspan="3">Scores</th>
</tr>
<tr>
<th id="english" scope="col">English</th>
<th id="maths" scope="col">Maths</th>
<th id="science" scope="col">Science</th>
</tr>
<tr>
<td headers="scores english">12</td>
<td headers="scores maths">16</td>
<td headers="scores science">20</td>
</tr>
</table>
+6
, ...
<table>
<caption>Scores</caption>
<thead>
<tr>
<th scope="col">English</th>
<th scope="col">Maths</th>
<th scope="col">Science</th>
</tr>
</thead>
<tbody>
<tr>
<td>12</td>
<td>16</td>
<td>20</td>
</tr>
</tbody>
</table>
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/caption
+1