我想制作一个如下所示的表格
------------------------------------------------------------------------------------
| Column 1 | Column 2 | Column 3 | Column 4 |
| Long Text |
------------------------------------------------------------------------------------
| Column 1 | Column 2 | Column 3 | Column 4 |
| Long Text |
------------------------------------------------------------------------------------
td“长文本”与第 1、2、3 和 4 列共享相同的 tr。如何强制 td 移至同一 tr 中的“下一行”?
我尝试按照以下方式将 {display:block} 属性放入“长文本”的 td http://jsfiddle.net/hDsts/ 。但是,这不起作用。
有没有好的解决方案?
最佳答案
<style>td, th{border: 1px solid;}</style>
<table>
<tr>
<th>Col1</th>
<th>Col2</th>
<th>Col3</th>
<th>Col4</th>
</tr>
<tr>
<td colspan="4">Verrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrry long text ?</td>
</tr>
<tr>
<td>Col1</td>
<td>Col2</td>
<td>Col3</td>
<td>Col4</td>
</tr>
<tr>
<td colspan="4">Verrrrryyy LONG</td>
</tr>
</table>
像这样吗?
您有行跨距和列跨距。
rowspan 这样做:
+----------------------+------+------+------+
| Col1 | Col2 | Col3 | Col4 |
+ +------+------+------+
| | x | x | x |
+ +------+------+------+
| | Col2 | Col3 | Col4 |
+ +------+------+------+
| | | x | x |
+----------------------+------+------+------+
关于html - 在同一 tr 的下一行显示 td 元素,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31440831/