0629作业
作业内容:写一个商品信息表,要求有id,品名,价格,数量,金额等字段, 最后要有合计,如总数, 总金额,并且商品按品类进行合并显示,要求用到行与列的合并
作业结果
代码
<!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>
<table border="1">
<caption>商品信息表</caption>
<tbody>
<tr bgcolor="lightblue">
<td>品类</td>
<td>ID</td>
<td>品名</td>
<td>价格</td>
<td>数量</td>
<td>金额</td>
</tr>
<tr>
<td rowspan="2";>水果</td>
<td>A1</td>
<td>苹果</td>
<td>5.5</td>
<td>5</td>
<td>27.5</td>
</tr>
<tr>
<td>A2</td>
<td>香蕉</td>
<td>1.8</td>
<td>2</td>
<td>3.6</td>
</tr>
<tr>
<td rowspan="2";>蔬菜</td>
<td>A3</td>
<td>草莓</td>
<td>3.8</td>
<td>8</td>
<td>30.4</td>
</tr>
<tr>
<td>A4</td>
<td>草莓</td>
<td>3.8</td>
<td>8</td>
<td>30.4</td>
</tr>
</tbody>
<tfoot>
<tr bgcolor="yellow">
<td colspan="2">总数量</td>
<td>23</td>
<td colspan="2">总金额</td>
<td>91.9</td>
</tr>
</tfoot>
</table>
</body>
</html>