【发布时间】:2021-05-18 06:15:12
【问题描述】:
我使用 *ngFor 来显示多个按钮,它可以有很多按钮。目前,我将所有按钮放在一列中,即一列之下。
但我只想连续显示 2 个按钮,这意味着,在上述情况下,这些绿色按钮应该在一行中,而 2 个红色按钮应该在其下方的下一行。我该怎么做?
这是我试过的:
<div class="row mt-3">
<div class="col-sm-5"></div>
<div class="col-sm-7">
<div *ngFor="let actionButton of actionButtonData">
<div *ngIf="actionButton.Direction === 1">
<button type="button" class="btn actionButton btn-success">
{{ actionButton.Name }}
</button>
</div>
<div *ngIf="actionButton.Direction === 2">
<button type="button" class="btn actionButton btn-danger">
{{ actionButton.Name }}
</button>
</div>
</div>
</div>
</div>
css
.actionButton {
width: 200px;
display: inline-block;
overflow: hidden !important;
white-space: nowrap;
text-overflow: ellipsis
}
【问题讨论】:
-
你也可以添加你的css代码@techguy
-
@Aahad 添加...请检查
-
你添加了很多空 div 删除它们并检查!
-
你检查了吗?
-
@Aahad 我尝试了不同的方式。及其工作
标签: html css angular typescript twitter-bootstrap