如何以HTML显示表格主体
在HTML中使用<tbody>标记显示表格主体。HTML<tbody>标记用于将主体添加到表中。tbody标签与thead标签和tfoot标签一起用于确定表格的每个部分(页眉,页脚,正文)。
示例
您可以尝试运行以下代码以HTML形式显示表主体-
<!DOCTYPE html> <html> <head> <title>HTML tbody 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>