<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<style>
td {
text-align: center;
}
</style>
<!-- 表格td文本居中 -->
<!-- 表头 -->
<table border="1" width="80%" cellspacing="0" cellpadding="3">
<!-- cellspacing表格横线内宽度 表格空白的行高 border 表格横线外宽度-->
<!-- 标题 -->
<caption>商品信息表</caption>
<thead bgcolor="yellow">
<tr>
<th>购买人</th>
<th>品名</th>
<th>单价</th>
<th>数量</th>
<th>金额</th>
</tr>
</thead>
<!-- 表体 -->
<tbody>
<tr>
<td rowspan="2" bgcolor="lightblue">张三</td>
<td>苹果手机6s</td>
<td>5000</td>
<td>1</td>
<td>5000</td>
</tr>
<!-- 列的合并需要两行都在同一个tbody中才可以生效 -->
<tr>
<!-- <td>1</td> -->
<td>苹果手机6</td>
<td>5000</td>
<td>1</td>
<td>5000</td>
</tr>
</tbody>
<tbody>
<tr>
<td bgcolor="lightblue">李四</td>
<td>蓝牙耳机</td>
<td>1300</td>
<td>2</td>
<td>2600</td>
</tr>
</tbody>
<tbody>
<tr>
<td bgcolor="lightblue">老吴</td>
<td>充电线</td>
<td>20</td>
<td>5</td>
<td>100</td>
</tr>
<!-- 表尾 -->
<tfoot>
<tr>
<td colspan="4" bgcolor="red">总金额</td>
<td>7700</td>
</tr>
</tfoot>
</table>
</body>
</html>