使用HTML中的标签来创建表头。HTML中的标签用于向表格添加表头。thead标签与tbody标签和tfoot标签一起用于确定表格的每个部分(表头、表尾、表体)。 HTML中的标签还支持以下附加属性: left center justify char middle bottom baseline 您可以尝试运行以下代码来学习如何在HTML中实现标签:
属性
值
描述
align
right
已弃用− 可视对齐。
char
character
已弃用− 指定要对齐文本的字符。当align = "char"时使用。
charoff
pixels or %
已弃用− 指定与char属性指定的第一个字符的对齐偏移量(以像素或百分比值表示)。当align = "char"时使用。
valign
top
已弃用− 垂直对齐。
示例
<!DOCTYPE html>
<html>
<head>
<title>HTML thead Tag</title>
</head>
<body>
<table style = "width:100%" border = "1">
<thead>
<tr>
<td colspan = "4">This is the head of the table</td>
</tr>
</thead>
<tfoot>
<tr>
<td colspan = "4">This is the foot of the table</td>
</tr>
</tfoot>
<tbody>
<tr>
<td>Cell 1</td>
<td>Cell 2</td>
<td>Cell 3</td>
<td>Cell 4</td>
</tr>
<tr>
...more rows here containing four cells...
</tr>
</tbody>
<tbody>
<tr>
<td>Cell 1</td>
<td>Cell 2</td>
<td>Cell 3</td>
<td>Cell 4</td>
</tr>
<tr>
...more rows here containing four cells...
</tr>
</tbody>
</table>
</body>
</html>
以上就是在HTML中如何创建表头?的详细内容,更多请关注编程之家其它相关文章!
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。