其实两者差别挺明显的,thead用于定义表头的内容,比如下面代码加黑的部分,定义表头的颜色等样式
而th标签则和td标签同时使用,分别定义表头内容和表格数据数据。
thead组合表头内容
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>测试</title>
<style type="text/css">
thead {color:green;}
tbody {color:blue;}
tfoot {color:red;}
</style>
</head>
<body>
<table border="1">
<thead>F
<tr>
<th>Month</th>
<th>Savings</th>
</tr>
</thead>
<tfoot>
<tr>
<td>Sum</td>
<td>$180</td>
</tr>
</tfoot>
<tbody>
<tr>
<td>January</td>
<td>$100</td>
</tr>
<tr>
<td>February</td>
<td>$80</td>
</tr>
</tbody>
</table>
<p><b>提示:</b> thead, tbody, 和 tfoot 元素默认不会影响表格的布局。不过,您可以使用 CSS 来为这些元素定义样式,从而改变表格的外观。</p>
</body>
</html>
---------------------------------------------------------
<!表格>
Month Savings
Sum $180
January $100
February $80
提示: thead, tbody, 和 tfoot 元素默认不会影响表格的布局。不过,使用 CSS 来为这些元素定义样式,从而改变表格的外观。