是否可以专门对div元素执行此操作:
<span class="wrap">
<div></div>
<div></div>
<div class="big"></div>
<div></div>
<div></div>
<div class="big"></div>
<div></div>
<div></div>
<div></div>
<div></div>
</span>
使用flexbox?这是一个小提琴,我一直在玩,但无法让它工作:
https://jsfiddle.net/kwqp4mmj/
是否有可能让它们每10个div重复一次?
答案 0 :(得分:3)
嵌套的flexbox可以实现这一点:
flex-container {
display: flex;
}
flex-item {
flex-grow: 1;
height: 200px;
margin: 0 5px;
display: flex;
flex-direction: column;
}
.big {
flex: 0 0 40%;
background-color: black;
}
div {
flex-grow: 1;
background-color: black;
}
div + div { margin-top: 10px; }
<flex-container>
<flex-item>
<div></div>
<div></div>
</flex-item>
<flex-item class="big"></flex-item>
<flex-item>
<div></div>
<div></div>
</flex-item>
</flex-container>
<br><hr><br>
<flex-container>
<flex-item class="big"></flex-item>
<flex-item>
<div></div>
<div></div>
</flex-item>
<flex-item>
<div></div>
<div></div>
</flex-item>
</flex-container>