用途
<th> 标签定义HTML表格中的表格头部单元格。该元素中的文本一般显示为居中粗体文本,而<td>元素内的文本一般是左对齐普通文本。
例子
<table width="600px" border="1">
<tr>
<th>First</th>
<th>Second</th>
<th>Third</th>
</tr>
<tr>
<td>First Cell</td>
<td>Second Cell</td>
<td>Third Cell</td>
</tr>
<tr>
<td>First Cell</td>
<td>Second Cell</td>
<td>Third Cell</td>
</tr>
<tr>
<td>First Cell</td>
<td>Second Cell</td>
<td>Third Cell</td>
</tr>
</table>
执行结果
First | Second | Third |
---|---|---|
First Cell | Second Cell | Third Cell |
First Cell | Second Cell | Third Cell |
First Cell | Second Cell | Third Cell |
标准属性
属性 | 描述 |
---|---|
colspan | 规定此单元格可横跨的列数。 |
rowspan | 规定此单元格可横跨的行数。 |
<th> 标签在HTML5与HTML4.01之间存在如下差异