是否可以垂直呈现表格行:如果我有这样的代码,
<table>
<tr>
<td>row1 - cell1</td>
<td>row1 - cell2</td>
<td>row1 - cell3</td>
</tr>
<tr>
<td>row2 - cell1</td>
<td>row2 - cell2</td>
<td>row2 - cell3</td>
</tr>
<tr>
<td>row3 - cell1</td>
<td>row3 - cell2</td>
<td>row3 - cell3</td>
</tr>
</table>
这将呈现一个这样的表:
row1-cell1 | row1-cell2 | row1-cell3
------------------------------------
row2-cell1 | row2-cell2 | row2-cell3
------------------------------------
row3-cell1 | row3-cell2 | row3-cell3
我想要的是这样展示它
row1-cell1 | row2-cell1 | row3-cell1
------------------------------------
row1-cell2 | row2-cell2 | row3-cell2
------------------------------------
row1-cell3 | row2-cell3 | row3-cell3
3条答案
按热度按时间oxcyiej71#
您可以在表行上使用
display: inline-flex;
和flex-direction: column;
来实现这一点。qc6wkl3g2#
假设你有一个对象数组:
6tdlim6h3#
CSS样式
输出