<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>table</title>
<style type="text/css">
tr td{font-size:30px;color:#000;text-align:center;25%}
.red{background:#ccc}.green{background:#F9CC9D}.pink{background:pink}.grey{background:grey}
pre{font-size:25px;color:#000}strong{color:red;}
</style>
</head>
<body>
<pre>
<strong>table合并</strong>
tr为行,td为列
</pre>
<table border= "1 " width= "500 " height="250" >
<tr class="red">
<td >A</td>
<td ></td>
<td ></td>
<td ></td>
</tr>
<tr class="green">
<td >B</td>
<td ></td>
<td ></td>
<td ></td>
</tr>
<tr class="pink">
<td ></td>
<td >C</td>
<td >D</td>
<td ></td>
</tr>
</table>
<pre>
A,B<strong>纵向</strong>合并,则A的标签(td)留下,删除后面需要合并的B标签(td)
然后给A加 <strong>rowspan="n"</strong>属性,n为合并单元格的数量
C,D<strong>横向</strong>合并,则C的标签(td)留下,删除后面需要合并的D标签(td)
然后给C加 <strong>colspan="n"</strong>属性,n为合并单元格的数量
</pre>
<table border= "1 " width= "500 " height="250" >
<tr class="red">
<td rowspan="2">A+B</td>
<td ></td>
<td ></td>
<td ></td>
</tr>
<tr class="green">
<td ></td>
<td ></td>
<td ></td>
</tr>
<tr class="pink">
<td ></td>
<td colspan="2">C+D</td>
<td ></td>
</tr>
</table>
</body>
</html>