我试图实现这样的布局:
以下是我目前的代码:
.cont {
display: flex;
flex-direction: column;
flex-wrap: wrap;
height: 500px;
}
.cell{
border: 2px solid black;
}
.cell-1 {
flex-basis: 100%;
width: 70%;
margin-right: 25px;
}
.cell-2,
.cell-3 {
width: 30%;
}
@media (max-width: 1000px) {
.cont{
flex-wrap: nowrap;
}
.cell {
width: 100%;
}
.cell-1, .cell-2, cell-3 {
width: 100%;
}
.cell-1 {
order: 2;
}
.cell-2 {
order: 1;
}
.cell-3 {
order: 3;
}
<div class="cont">
<div class="cell cell-1">
<h2>One</h2>
</div>
<div class="cell cell-2">
<h2>Two</h2>
</div>
<div class="cell cell-3">
<h2>Three</h2>
</div>
</div>
问题是我需要
height
到
.cont
为了使列以宽屏模式包装,我不能这样做,因为内容大小可变。例如,如果我的文章只有两个小段落
cell-1
高度
属于
500px
这会导致页脚离
(续)
. 或者如果我有很多内容
和一个
height: 500px
,它将导致内部内容
(续)
在页脚下。
你有什么建议来解决这个问题?
codepen