HTML <th> scope 屬性
示例
指定這兩個表頭單元格是列的表頭
<table>
<tr>
<th></th>
<th scope="col">月份</th>
<th scope="col">儲蓄</th>
</tr>
<tr>
<td>1</td>
<td>一月</td>
<td>$100</td>
</tr>
<tr>
<td>2</td>
<td>二月</td>
<td>$80</td>
</tr>
</table>
自己動手試一試 »
定義和用法
scope
屬性指定表頭單元格是列、行或列/行組的表頭。
注意:scope
屬性在普通網頁瀏覽器中沒有視覺效果,但可供螢幕閱讀器使用。
瀏覽器支援
Attribute | |||||
---|---|---|---|---|---|
scope | 是 | 是 | 是 | 是 | 是 |
語法
<th scope="col|row|colgroup|rowgroup">
屬性值
值 | 描述 |
---|---|
col | 指定單元格是列的表頭 |
row(行) | 指定單元格是行的表頭 |
colgroup | 指定單元格是列組的表頭 |
rowgroup | 指定單元格是行組的表頭 |
<th> 標籤