让div填满剩下的空间

版权声明:@copyright by taorui https://blog.csdn.net/weixin_42541498/article/details/81097304

让div填满剩下的空间 

方案一 

一 如果parent是body 

div2{
    position:fixed;
    top:hpx;
    bottom:0;
}

二 如果parent是div

.parent{
    position:relative;
}
.div2{
    position:absolute;
    top:hpx;
    bottom:0;
}

方案二 

.parent{
    position:relative;
    padding-top:hpx;
}
.div1{
    position:absolute;
    top:0;
    width:100%;/*定位元素据用包裹性*/
}
.div2{
    height:100%;
}

猜你喜欢

转载自blog.csdn.net/weixin_42541498/article/details/81097304