HTML 5 <th> scope 属性
实例
规定两个表头单元格是两个列的头部:
<table>
<tr>
<th></th>
<th scope="col">月份</th>
<th scope="col">存款</th>
</tr>
<tr>
<td>1</td>
<td>一月</td>
<td>3000 元</td>
</tr>
<tr>
<td>2</td>
<td>二月</td>
<td>5000 元</td>
</tr>
</table>
浏览器支持
scope 属性在普通的 web 浏览器中没有可见效果,但可被屏幕阅读器使用。
定义和用法
scope 属性规定此表头单元格是否是行、列、行组或列组的头部。
HTML 4.01 与 HTML 5 之间的差异
无差别。
语法
<th scope="col|row|colgroup|rowgroup">
属性值
| 值 | 描述 |
|---|---|
| col | 规定表头单元格是列的表头。 |
| row | 规定表头单元格是行的表头。 |
| colgroup | 规定表头单元格是列组的表头。 |
| rowgroup | 规定表头单元格是行组的表头。 |