<div class="wrapper" id="wrapper" style="height: 100%;">
<div class="searchForm" id="searchForm"></div>
<div class="tableContent" id="tableContent"></div>
</div>
方法一:
var wrapper= document.getElementById('wrapper');
var searchForm = document.getElementById('searchForm');
var tableContent= document.getElementById('tableContent');
tableContent.style.height = wrapper.clientHeight - header.clientHeight+'px';
方法二(推荐):
.wrapper{
display:flex;
flex-direction: column; //竖轴方向
}
.tableContent{
flex:auto; //自动铺满剩余空间
}
方法三(上部分div高度固定可用,利用定位值填充剩余空间)
.tableContent {
position: absolute;
top: 100px;
left: 0;
bottom: 0;
width: 100%;
}