如果不考虑js的话可以用flex实现html>
.box{width:200px; height: 150px;display: flex;flex-direction:column } .div2{flex: auto;}
123
123123
如果考虑js的话那也很简单
html>
.box{width:200px; height: 150px;}
123
123123
var box = document.getElementsByClassName('box')[0]; var div1 = document.getElementsByClassName('div1')[0]; var div2 = document.getElementsByClassName('div2')[0];
div2.style.height = box.clientHeight - div1.clientHeight + "px";