Blogger Information
Blog 21
fans 0
comment 0
visits 9983
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
表格学习制作
放手去爱
Original
445 people have browsed it

<!DOCTYPE html>

<html lang="zh-CN">
<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" />
<style>
table {
width: 400px;
border-collapse: collapse;
text-align: center;
}
table th,
table td {
border: thin solid #888;
padding: 5px;
}
table caption {
font-size: 1.2em;
margin-bottom: 0.5em;
letter-spacing: 0.5em;
}
table thead,
table tfoot tr [colspan] {
background-color: lightcyan;
}

table + button {
padding: 5px 20px;
letter-spacing: 5px;
margin: 10px 10px 10px 320px;
background-color: violet;
border: none;
cursor: pointer;
}
table + button:hover {
cursor: pointer;
background-color: orangered;
color: #fff;
transition: 0.5s;
}

.green {
background-color: lightgreen;
}
.wheat {
background-color: wheat;
}
</style>
<title>细说表格</title>
</head>
<body>
<table border="1">
<!-- 标题(可选) -->
<caption>
购物车
</caption>

<!-- 表头 -->
<thead>
<tr>
<th>分类</th>
<th>ID</th>
<th>品名</th>
<th>单价</th>
<th>数量</th>
<th>金额</th>
</tr>
</thead>

<!-- 表体(必选)浏览器自动生成,一个表格中可以有多个tbody -->
<tbody>
<!-- 先写tr,创建一个新行(单元格的容器) -->
<tr>
<!-- td: 单元格,数据存放的地方 -->
<!-- td,th: 都是单元格,th有预置样式: 加粗和居中 -->

<!-- 前三行的第一列,需要做一个跨行的合并 -->
<!-- 跨行合并 : rowspan, row行 span 合并 -->
<!-- 合并属性 rowspan/colspan,必须写到td, th中 -->
<td rowspan="3">数码</td>
<th>5010</th>
<td>笔记本</td>
<td>9000</td>
<td>2</td>
<td>18000</td>
</tr>
<tr>
<!-- <td>数码</td> -->
<th>5012</th>
<td>手机</td>
<td>5000</td>
<td>4</td>
<td>20000</td>
</tr>
<tr>
<!-- <td>数码</td> -->
<th>5013</th>
<td>相机</td>
<td>15000</td>
<td>2</td>
<td>30000</td>
</tr>
<tr>
<td rowspan="2">服装</td>
<th>3030</th>
<td>男装</td>
<td>500</td>
<td>2</td>
<td>1000</td>
</tr>
<tr>
<!-- <td>服装</td> -->
<th>3031</th>
<td>女装</td>
<td>1000</td>
<td>5</td>
<td>5000</td>
</tr>
</tbody>

<!-- 表尾 -->
<tfoot>
<tr>
<!-- 水平方向合并/列合并 : colspan -->
<th colspan="4">总计:</th>
<th>15</th>
<th>74000</th>
</tr>
</tfoot>
</table>
<button>结算</button>
</body>
</html>

Correcting teacher:PHPzPHPz

Correction status:qualified

Teacher's comments:
Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post