To form a logical relation between the headers and the corresponding data in data tables <th> tags are used. These <th> tags are supported with HTML scope attribute. scope=â€col†form a relation between column header and its corresponding data. In certain scenarios use of <th scope=â€colâ€> might not be possible. Usage of role=â€columnheader†helps in these situations. Role=â€rowheader†does the same functionality for <th scope=â€rowâ€>. Screen readers like JAWS and NVDA will recognize the columnheader (role) and rowheader(role).
Example
<table summary=â€Marks of students for class IXâ€>
<tr>
<td role=â€columnheaderâ€>Names</td>
<td role=â€columnheaderâ€>Mathematics</td>
<td role=â€columnheaderâ€>Physics</td>
<td role=â€columnheaderâ€>Chemistry</td>
</tr>
<tr>
<td role=â€rowheaderâ€>Student A</td>
<td>70</td>
<td>80</td>
<td>90</td>
</tr>
<tr>
<td role=â€rowheaderâ€>Student B</td>
<td>60</td>
<td>70</td>
<td>80</td>
</tr>
<tr>
<td role=â€rowheaderâ€>Student C</td>
<td>75</td>
<td>85</td>
<td>95</td>
</tr>
</table>
Next Combobox role