【发布时间】:2018-06-15 20:32:53
【问题描述】:
我在 Angular 5 组件中有这个 html:
.row>div {
flex-basis: calc(50% - 20px) !important;
/* width less horizontal margins */
margin: 10px;
}
<div fxLayout="column">
<div fxLayout="row">
<button mat-raised-button color="accent">
<mat-icon>play_button</mat-icon>
Start Recording
</button>
</div>
<div fxLayout="row">
</div>
<div fxLayout="row">
<button mat-raised-button color="accent">
<mat-icon>play_button</mat-icon>
Stop Recording
</button>
</div>
<div fxLayout="row">
</div>
<div fxLayout="row">
<div fxLayout="column">
<div>
<mat-checkbox>Firefox</mat-checkbox>
</div>
<div>
<mat-checkbox>Chrome</mat-checkbox>
</div>
<div>
<mat-checkbox>Allow XPath</mat-checkbox>
</div>
</div>
</div>
</div>
它呈现为:
我尝试添加这个 CSS 来增加元素之间的间距:
.row > div {
flex-basis: calc(50% - 20px) !important; /* width less horizontal margins */
margin: 10px;
}
但这不起作用 - 如何在元素之间添加垂直间距?
【问题讨论】:
-
我从这里得到了 CSS:stackoverflow.com/questions/38506233/…
-
可以用自定义属性覆盖现有的 flex 属性吗?
-
老实说我不知道
-
我参考了他们的文档,查看答案,希望对您有所帮助