HTML th scope 屬性
實例
把兩個表頭單元格規定為列的表頭:
<table border="1">
<tr>
<th></th>
<th scope="col">Month</th>
<th scope="col">Savings</th>
</tr>
<tr>
<td>1</td>
<td>January</td>
<td>$100</td>
</tr>
<tr>
<td>2</td>
<td>February</td>
<td>$80</td>
</tr>
</table>
<tr>
<th></th>
<th scope="col">Month</th>
<th scope="col">Savings</th>
</tr>
<tr>
<td>1</td>
<td>January</td>
<td>$100</td>
</tr>
<tr>
<td>2</td>
<td>February</td>
<td>$80</td>
</tr>
</table>
嘗試一下»
瀏覽器支持
scope 屬性在普通的Web 瀏覽器中沒有視覺效果,但可以通過屏幕閱讀器使用。
定義和用法
scope 屬性規定某個表頭單元格是否是列、行、列組或行組的表頭。
HTML 4.01 與HTML5之間的差異
無。
語法
<th scope="col|row|colgroup|rowgroup">
屬性值
值 | 描述 |
---|---|
col | 规定单元格是列的表头。 |
row | 规定单元格是行的表头。 |
colgroup | 规定单元格是列组的表头。 |
rowgroup | 规定单元格是行组的表头。 |
HTML <th>標籤