方法:弹性布局,上下写固定宽高,中间flex:1
html代码:
<div class="content">
<div class="top"></div>
<div class="middle"></div>
<div class="bottom"></div>
</div>
css代码:
.content{
height: 100vh;
display: flex;
flex-direction: column;
}
.top,.bottom{
height:100px
}
.middle{
flex:1;
overflow-y:auto
}