原生表格
一、合并单元格的方式
- 跨行合并
rowspan="合并单元格的个数"
- 跨列合并
colspan="合并单元格的个数"
带内容
<!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>
<style>
img {
width: 168px;
height: 260px;
}
</style>
</head>
<body>
<table width="400" height="250" border="1" cellspacing="0">
<tr>
<td rowspan="4">
<img
src="http://alita.ashun01.eu.org/picgo/2022/ashun-10.png"
alt=""
/>
</td>
<td colspan="2">Land pledge</td>
</tr>
<tr>
<td>Daily interest:</td>
<td>1.8%</td>
</tr>
<tr>
<td>Term:</td>
<td>3 month</td>
</tr>
<tr>
<td>End time:</td>
<td>2022-8-5</td>
</tr>
</table>
</body>
</html>
没内容
<!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>
<style></style>
</head>
<body>
<table width="400" height="250" border="1" cellspacing="0">
<tr>
<td rowspan="4"></td>
<td colspan="2"></td>
</tr>
<tr>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td></td>
</tr>
</table>
</body>
</html>
总结
简单地说,合并单元格分为三步:
-
确定跨列合并还是跨行合并
-
找到目标单元格,并在目标单元格中添加合并代码
-
删除多余单元格