您好,欢迎访问一九零五行业门户网

如何在HTML中创建表格页脚?

本文中我们要执行的任务是如何在 html 中创建表页脚。由于我们对 html 中的表格很熟悉,所以让我们快速了解一下它。
当您想要组织在电子表格中看起来最好的数据时,html 表格非常有意义。表是数据行和列的直观表示。您可以使用表格将照片、文本、链接等数据组织到 html 单元格的行和列中。
html 表格页脚在 html 表格中,
标记指定组成表格页脚的一组行。它可用于统计表中的列,并经常用于显示列总计。传统上,您将使用 css 设计 标记来引起对列总计的注意。 元素是此标记经常使用的另一个名称。为了更好地了解如何在 html 中创建表页脚。让我们看看下面的例子
示例 1在下面的示例中,我们使用
标记将页脚添加到表格中。<!doctype html><html><body> <table width=400 border=1> <caption> fastest 100 in odi's <hr> </caption> <thead> <tr> <th>name</th> <th>country</th> <th>balls</th> </tr> </thead> <tfoot> <tr> <th colspan=3>ab de villiers- the best player!</th> </tr> </tfoot> <tbody> <tr> <td>ab de villiers</td> <td>south africa</td> <td>31</td> </tr> <tr> <td>cj anderson</td> <td>new zealand</td> <td>36</td> </tr> <tr> <td>shahid afridi</td> <td>pakistan</td> <td>37</td> </tr> </tbody> </table></body></html>
运行上述脚本时,会弹出输出窗口,显示使用上述脚本中使用的数据创建的表格,以及添加到网页表格中的页脚文本。
示例 2考虑以下示例,我们将使用 css 添加 的样式。
<!doctype html><html><head> <style> thead {color: #58d68d;} tbody {color:#a569bd ;} tfoot {color:#2c3e50 ;} table, th, td { border: 1px solid black; } </style></head><body> <h1>monthly savings</h1> <table> <thead> <tr> <th>month</th> <th>savings</th> </tr> </thead> <tbody> <tr> <td>octomber</td> <td>$25</td> </tr> <tr> <td>november</td> <td>$50</td> </tr> <tr> <td>december</td> <td>$30</td> </tr> </tbody> <tfoot> <tr> <td>total</td> <td>$105</td> </tr> </tfoot> </table></body></html>
执行脚本时,它将生成一个输出,显示根据脚本数据绘制的表格以及添加到网页的页脚。
示例 3让我们看一下另一个例子,我们正在创建一个带页脚的表格。
<!doctype html><html><head> <style> table, td { border: 1px solid black; } </style></head><body> <table style = width:100%> <thead> <tr> <td colspan = 4>this is the head of the table</td> </tr> </thead> <tfoot> <tr> <td colspan = 4>this is the footer 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> </tbody> <tbody> <tr> <td>cell 1</td> <td>cell 2</td> <td>cell 3</td> <td>cell 4</td> </tr> </tbody> </table></body></html>
运行上述脚本时,它将生成一个输出,其中包含使用脚本中给出的数据绘制的表格以及网页上的页脚。
以上就是如何在html中创建表格页脚?的详细内容。
其它类似信息

推荐信息