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 | 是 | 是 | 是 | 是 | 是 |