html 垂直撑满,html – Div展开以目视填充垂直空间

我有一个页面,有一个标题,内容和页脚。页眉和页脚具有固定的高度,我希望内容调整其高度,以便它在页眉和页脚之间动态配合。我打算在我的内容中放置一个背景图像,所以至关重要的是它实际上填满了剩下的空闲垂直空间。

我使用Sticky Footer方法确保页脚保持在页面的底部。然而,这不会使内容跨越剩余空间的整个高度。

我已经尝试了几个解决方案,涉及我添加高度:100%,height:auto;位置:相对,但它没有工作。

html,

body {

height: 100%;

background-color: yellow;

}

header {

width: 100%;

height: 150px;

background-color: blue;

}

header nav ul li {

display: inline;

padding: 0 30px 0 0;

float: left;

}

#wrapper {

min-height: 100%;

height: auto !important;

height: 100%;

margin: 0 0 -30px 0;

/* the bottom margin is the negative value of the footer's height */

position: relative;

}

#wrapper #content {

background-color: pink;

width: 400px;

height: 100%;

margin: 0 0 -30px 100px;

padding: 25px 30px 25px 30px;

}

footer {

margin: -30px 0 0 0;

width: 100%;

height: 30px;

background-color: green;

}

  • About
  • Menu
  • Specials

content


goes


here

footer

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值