HTML: <th> scope 属性

由网友 大卫 发布 阅读 6

HTML: <th> scope 属性

<th> scope 属性的使用方法,scope 属性规定某个表头单元格是否是列、行、列组或行组的表头,在线实例演示如何使用 <th> scope 属性、浏览器的兼容性、语法定义及它的属性值详细资料等。

 HTML <th> 标签

在线示例

把两个表头单元格指定为列的表头:

<table style="width:100%" border="1">
  <tr>
    <th>ID</th>
    <th scope="col">年份</th>
    <th scope="col">储蓄</th>
  </tr>
  <tr>
      <td>1</td>
    <td>2018</td>
    <td>$19320.00</td>
  </tr>
  <tr>
      <td>2</td>
    <td>2019</td>
    <td>$28320.00</td>
  </tr>
</table>
测试看看 ‹/›

浏览器兼容性

IEFirefoxOperaChromeSafari

scope属性在普通的Web浏览器中没有视觉效果,但是可以由屏幕阅读器使用。

定义和用法

scope 属性指定某个表头单元格是否是列、行、列组或行组的表头。

HTML 4.01 与 HTML5之间的差异

没有。

语法

<th scope="col|row|colgroup|rowgroup">

属性值

描述
col指定单元格是列的表头。
row指定单元格是行的表头。
colgroup指定单元格是列组的表头。
rowgroup指定单元格是行组的表头。
 HTML <th> 标签

HTML: <th> valign 属性 HTML: <th> rowspan 属性