HTML headers 属性
定义和用法
The headers attribute specifies one or more header cells a table cell is related to.
适用范围
The headers attribute can be used on the following elements
| 元素 | Attribute |
|---|---|
| <td> | headers |
| <th> | headers |
示例
Td 示例
指定每个 <td> 元素相关的 <th> 元素
<table>
<tr>
<th id="name">Name</th>
<th id="email">Email</th>
<th id="phone">Phone</th>
<th id="addr">Address</th>
</tr>
<tr>
<td headers="name">John Doe</td>
<td headers="email">someone@example.com</td>
<td headers="phone">+45342323</td>
<td headers="addr">Rosevn 56,4300 Sandnes,Norway</td>
</tr>
</table>
自己动手试一试 »
Th 示例
指定每个表头单元格相关的 <th> 元素
<table>
<tr>
<th id="name" colspan="2">Name</th>
</tr>
<tr>
<th headers="name">Firstname</th>
<th headers="name">Lastname</th>
</tr>
</table>
自己动手试一试 »
浏览器支持
The headers attribute has the following browser support for each element
| 元素 | |||||
|---|---|---|---|---|---|
| td | 是 | 是 | 是 | 是 | 是 |
| th | 是 | 是 | 是 | 是 | 是 |