【发布时间】:2021-02-10 14:19:06
【问题描述】:
我有一个看起来有点像这样的 flex 设计:
.columns {
flex-wrap: wrap;
display: flex;
}
.column {
display: block;
}
.column.is-8 {
flex: none;
width: 66.66667%;
}
.column.is-4 {
flex: none;
width: 33.33333%;
}
.box-1 {
background-color: red;
height: 200px;
}
.box-2 {
background-color: yellow;
height: 400px;
}
.box-3 {
background-color: blue;
height: 800px;
}
*, *::before, *::after {
box-sizing: inherit;
}
<div class="columns">
<div class="column is-8 box-1">
Box 1
</div>
<div class="column is-4 box-2">
Box 2
</div>
<div class="column is-8 box-3">
Box 3
</div>
</div>
<!-- on desktop: box 1, 2 and 3 -->
<!-- on mobile: box 1, 2 and 3 -->
如何防止框 2 压下框 3?所以它看起来像这样:
更新
我想在移动设备上添加,盒子的顺序应该相同(例如 1、2 然后 3)
【问题讨论】: