【发布时间】:2020-04-15 18:16:06
【问题描述】:
我有这段代码,我在顶部和底部有两个固定的导航栏。
我希望框的大小在两个导航栏之间,并随着导航的大小随着屏幕大小的变化而改变,以便始终看到边距和卡片的文本。
body, html{
width:100%;
height:100%;
margin:0;
}
.nav{
padding:5px;
margin:0;
position:fixed;
width:100%;
background-color:#84a9ca;
font-size:5vh;
}
.bas{
opacity:0.5;
bottom:0;
}
.box{
width:100%;
height:100%;
background-color:#6ec6e1;
display:flex;
justify-content:space-around;
}
.element{
background-color:#488a45;
width:100px;
margin:5px;
}
<!--change with the size of the window-->
<div class="nav haut">nav</div>
<!--take all the place but want it to be just between the navs-->
<div class="box">
<!--text and margin hidden by the nav-->
<div class="element">element</div>
<div class="element">element</div>
<div class="element">element</div>
</div>
<!--transparent to show what's behind-->
<div class="nav bas">nav</div>
【问题讨论】:
-
我建议看一下“网格布局”,它可能会让你的生活更轻松。
-
这就是我想要的:framapic.org/mQr3u0HDrUjG/iVb2KyO5MB3n.png 但反应灵敏
-
我想你的问题在这里得到了回答:Flexbox fill available space vertically!
标签: html css responsive-design flexbox responsive