【发布时间】:2019-03-23 02:08:21
【问题描述】:
我有一个有两个孩子的容器。我设置了 flex-wrap 属性和值换行。在小型设备中,当它们以未知宽度中断时,我该如何设置两个项目之间的边距/填充?
https://jsfiddle.net/irojabkhan/w1x5phya/4/
.container {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
}
.item {
background: blue;
font-size: 46px;
}
<div class="container">
<div class="item">Hello World</div>
<div class="item">Keep Learning</div>
</div>
【问题讨论】:
-
只需将 margin-bottom 添加到第一个元素
-
你是指哪个边距/填充?顶部、底部、垂直、水平、...?
-
可以是margin-top或者margin-bottom