页脚背景始终处于底部
问题描述:
我遇到了页面页脚的问题。我希望有一个页脚(背景)总是在页面的底部。如果浏览器变大,他的身高应该会增长。我见过stickyfooter,但在这种情况下身高并没有改变。谢谢。页脚背景始终处于底部
http://img688.imageshack.us/img688/2499/layoutus.png
这里是链接到的图像,以更好地解释。
答
将身体的背景颜色设置为页脚的背景颜色,用内容区域的首选背景颜色将您的内容包装在div
中。
答
在你的图片中,身体保持不变,只有页脚正在增长;为了达到这个目的,你必须为你的身体指定一个固定的高度。
如果你不是想他们俩长大的,这是代码:
HTML
<div id="main">I'm the body</div>
<div id="footer">I'm the enlarging footer</div>
CSS
body, html{
height: 100%;
}
#main{
background:silver;
min-height: 80%;
min-width: 100%;
height: 80%;
}
#footer{
background: green;
position: fixed;
bottom: 0;
min-height: 20%;
min-width: 100%;
}
是页脚背景图像或只是一种颜色? – 2013-02-21 12:57:09