css实现div的高度填满剩余空间

css实现div的高度填满剩余空间

方式1:绝对定位

.top{
width: 100%;
height: 70px;
}

.bottom{
background-color: #cc85d9;
width: 100%;
position: absolute;
top: 70px;
bottom: 0px;
left: 0px;
}

 方式2:border-sizing

html,
body {
height: 100%;
padding: 0;
margin: 0;
}

.container {
height: 100%;
padding: 70px 0 0;
box-sizing: border-box;
}

.bottom {
height: 100%;
background: #fd9740;
}

.top {
height: 70px;
margin: -70px 0 0;
background: #61e1f6;

width: 100%;
}


或者

.top {
height: 70px;

position: absolute;

top: 0;
left: 0;

background: #61e1f6;

width: 100%;
}

 

posted @ 2016-08-25 15:13  小哩  阅读(6524)  评论(0编辑  收藏  举报