【发布时间】:2018-07-22 13:38:37
【问题描述】:
我已经看到 table tr 以水平方式出现。如下:
<table style="width:50%;">
<tr>
<th>Month</th>
<th>Savings</th>
</tr>
<tr style="height:100px">
<td valign="bottom">January</td>
<td valign="bottom">$100</td>
</tr>
</table>
我的要求是:
Month January
Savings $100
但是,不能使用以下代码和 CSS - 垂直对齐。 Bcz,我正在使用角度 ngFor,我需要动态显示 1/2/3 列。
<table style="width:50%;">
<tr>
<th>Month</th>
<td valign="bottom">January</td>
</tr>
<tr style="height:100px">
<th>Savings</th>
<td valign="bottom">$100</td>
</tr>
</table>
我知道的当前解决方案是:
<table style="width:50%;">
<tr>
<th>Month</th>
<td *ngFor="let i of is">{{i.a}}</td>
</tr>
<tr style="height:100px">
<th>Savings</th>
<td *ngFor="let i of is">{{i.b}}</td>
</tr>
</table>
这里需要多次写ngFor。我用 div 和 css 做到了这一点,但我需要动态相同高度的所有行单元格 - 我没有看到这一点。如何使用 CSS 垂直显示表格 tr?
【问题讨论】:
-
所以你希望标题是垂直的
-
是的,相关数据也是垂直的
-
你可以试试这里提到的 CSS rotate stackoverflow.com/questions/41468762/…