有行与列合并的小案例表格
先看图:
实例代码:
<!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">
<title>课程表</title>
<style>
thead{
background-color: aquamarine;
}
tfoot{
background-color: aliceblue;
}
td{
text-align: center;
}
</style>
</head>
<body>
<table border="1px" align="center">
<caption>课程表</caption>
<thead>
<tr>
<th>名字</th>
<th>课程</th>
<th>练习时长</th>
<th>天赋</th>
<th>段位</th>
<th>分数</th>
</tr>
</thead>
<tbody>
<tr>
<td rowspan="4">ikun</td>
<td>唱</td>
<td rowspan="6">两年半</td>
<td>25</td>
<td>2.5</td>
<td>5</td>
</tr>
<tr>
<!-- <td>蔡徐坤</td> -->
<td>跳</td>
<!-- <td>10</td> -->
<td>25</td>
<td>2.5</td>
<td>5</td>
</tr>
<tr>
<!-- <td>蔡徐坤</td> -->
<td>Rap</td>
<!-- <td>10</td> -->
<td>25</td>
<td>2.5</td>
<td>5</td>
</tr>
<tr>
<!-- <td>ikun</td> -->
<td>篮球</td>
<!-- <td>10</td> -->
<td>25</td>
<td>2.5</td>
<td>5</td>
</tr>
<tr>
<td rowspan="2">ikun</td>
<td>背带裤</td>
<!-- <td>10</td> -->
<td>-</td>
<td>2.5</td>
<td>-</td>
</tr>
<tr>
<!-- <td>蔡徐坤</td> -->
<td>中分</td>
<!-- <td>10</td> -->
<td>25</td>
<td>-</td>
<td>5</td>
</tr>
</tbody>
<tfoot>
<tr>
<td colspan="4">合计</td>
<!-- <td>合计</td>
<td>合计</td>
<td>合计</td> -->
<td>半坤</td>
<td>25</td>
</tr>
</tfoot>
</table>
</body>
</html>
【文章原创作者:香港云服务器 http://www.558idc.com/ne.html 复制请保留原URL】ps:
rowspan=""
属性为行合并,以当前行开始计算colspan=""
属性为列合并,以当前列开始计算