就像在 Excel 工作表中一样,我可以有
- 第一行 2 列
- 第 2 行 1 长列
这在html中可能吗?
意识到你不熟悉colspan
,我想你也不陌生rowspan
,所以我想我会免费把它扔进去。
使用时需要注意的重要一点rowspan
: 下列tr
元素must包含较少td
元素,因为细胞使用rowspan
在上一行(或上一行rows).
table {
border: 1px solid #000;
border-collapse: collapse;
}
th,
td {
border: 1px solid #000;
}
<table>
<thead>
<tr>
<th colspan="2">Column one and two</th>
<th>Column three</th>
</tr>
</thead>
<tbody>
<tr>
<td rowspan="2" colspan="2">A large cell</td>
<td>a smaller cell</td>
</tr>
<tr>
<!-- note that this row only has _one_ td, since the preceding row
takes up some of this row -->
<td>Another small cell</td>
</tr>
</tbody>
</table>
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)