实例代码“Ctrl+/”提示“F11/ESC”全屏 返回 格式化 恢复 运行
x
 
1
<!DOCTYPE html>
2
<html>
3
<head>
4
<style type="text/css">
5
thead {color:green;}
6
tbody {color:blue;}
7
tfoot {color:red;}
8
</style>
9
</head>
10
<body>
11
12
<table border="1">
13
  <thead>
14
    <tr>
15
      <th>Month</th>
16
      <th>Savings</th>
17
    </tr>
18
  </thead>
19
  <tfoot>
20
    <tr>
21
      <td>Sum</td>
22
      <td>$180</td>
23
    </tr>
24
  </tfoot>
25
  <tbody>
26
    <tr>
27
      <td>January</td>
28
      <td>$100</td>
29
    </tr>
30
    <tr>
31
      <td>February</td>
32
      <td>$80</td>
33
    </tr>
34
  </tbody>
35
</table>
36
37
<p><b>Tip:</b> The thead, tbody, and tfoot elements will not affect the layout of the table by default. However, you can use CSS to style these elements.</p>
38
39
</body>
40
</html>
41