是否可以通过包装子代并将其与顶部对齐来创建Flexbox布局?
.container {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
}
.container .element {
flex: 0 0 auto;
}
创建此:
但我的计划是实现这一目标:
答案 0 :(得分:0)
.container {
border: 1px solid black;
padding: 10px;
height: 250px;
display: flex;
flex-wrap: wrap;
flex-direction: column;
align-content: flex-start;
overflow: hidden;
resize: both;
}
.container div {
border: 5px solid #AAA;
background-color: #DDD;
margin: 3px;
height: 100px;
width: 50px;
}
.container div:nth-child(3n) {
height: 40px;
}
<div>
<div class="container">
<div></div><div></div><div></div>
<div></div><div></div><div></div>
<div></div><div></div><div></div>
</div>
</div>
Some Text