我有3 div1header和Sidebar。main content我用过flexbox。.main有100vh height,.sidebar有100px height,.main-content有 100% height。但在移动设备上查看时,sidebar和之间会显示空白main-content。
.main {
min-height: 100vh;
background-color: red;
display: flex;
flex-wrap: wrap;
}
.sidebar {
background-color: blue;
height: 100px;
width: 100%;
}
.main-content {
background-color: yellow;
height: 100%;
width: 100%;
}
@media (min-width: 768px) {
.main-content{
width: 80%;}
.sidebar {
width: 20%
}
}
<div>Header</div>
<div class="main">
<div class="sidebar">
sidebar
</div>
<div class="main-content">
main-content
</div>
</div>
梦里花落0921
侃侃尔雅
沧海一幻觉
拉莫斯之舞
相关分类