在 HTML 中如何创建表格标题?
在 HTML 中使用 <thead> 标签来创建表格标题。HTML <thead> 标签用于给表格添加标题。thead 标签与 tbody 标签和 tfoot 标签结合使用来定义表格的各个部分(标题、页脚、正文)。
HTML <thead> 标签还支持以下附加属性 −
| 属性 | 值 | 说明 |
|---|---|---|
| align | right left center justify char | 已弃用 − 视觉对齐。 |
| char | character | 已弃用 − 指定将文本对齐到哪个字符。在 align = "char" 时使用 |
| charoff | 像素或百分比 | 已弃用 − 指定与使用 char 属性指定的第一个字符相比的对齐偏移(以像素或百分比为单位)。在 align = "char" 时使用 |
| valign | top middle bottom baseline | 已弃用 − 垂直对齐。 |
示例
你可以尝试运行以下代码来学习如何在 HTML 中实现 <thead> 标签 −
<!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>
广告
数据结构
网络
RDBMS
操作系统
Java
iOS
HTML
CSS
Android
Python
C 编程
C++
C#
MongoDB
MySQL
Javascript
PHP