我也有类似的问题,可以找到here。但是我不能让它工作,或者我完全不了解它。填充内容背景直到它到达页脚
我试图解决的问题是 - 即使没有足够的内容显示,我也希望我的内容背景能够达到页脚。我创建了一个简单的小提琴,可以找到here。正如你所看到的,没有足够的内容可以达到页脚,内容和页脚之间有这个“蓝色”空间。我想让这个空间变成灰色。
HTML:
<div class=blue>header here</div>
<p>LOGO here</p>
<div class="blue">navigation bar here</div>
<div class="content">
No content.
</div>
<div class="footer">footer is here</div>
CSS:
.blue {
color: #ffffff;
background-color: #294a70;
display: block;
float: none;
width: 400px;
margin: 0 auto;
text-align: center;
}
p {
text-align: center;
color: #ffffff;
}
.content {
background-color: #e6e6e6;
display: block;
float: none;
margin: 0 auto;
overflow:hidden;
width:400px;
margin-bottom:30px;
}
.footer {
color: #ffffff;
background-color: #294a70;
display: block;
float: none;
width: 400px;
margin: 0 auto;
text-align: center;
position: absolute;
bottom: 0;
left: 0;
right: 0;
height:30px;
}
body {
margin:0;
padding:0;
font-family: 'Open Sans', sans-serif;
line-height: 1.5;
font-size: 14px;
overflow-x:hidden;
background-image:url('http://www.planwallpaper.com/static/images/Alien_Ink_2560X1600_Abstract_Background_1.jpg');
min-height: 100%;
}
html {
position:relative;
min-height: 100%;
}
所有帮助将不胜感激!
我曾经在读过关于vh单元的一些内容,但并不理解它们,你只是简单地将它和我的例子设法在我的网站上实现它。所以谢谢你解决这个问题给我。 – RebelInc