自动CSS高度

时间:2012-08-13 13:10:34

标签: html css html5 css3

我的网站页脚有问题。应该如此,它是在页面内容之后呈现的,但是当页面的内容小于浏览器的高度时,在页面中间看到它会很烦人。

我正在纠正此行为,手动将页脚设置为position:absolute; bottom:0,但这样做会在内容大于浏览器高度时打破页脚。有什么方法可以自动化吗?

内容只是一个div,没有任何aditional风格,通常,页脚是position:relative; bottom:0。该网站可以在这里看到:http://vestibulandos.oplex.com.br

感谢。

2 个答案:

答案 0 :(得分:4)

答案 1 :(得分:1)

.wrapper {
margin: 0 auto -60px; /* the bottom margin is the negative value of the footer's height */
 }
 
/* FOOTER BOTTOM --------------------------------------------------------*/
 
.footer, .push {
    height: 60px; /* .push must be the same height as .footer */
}
 
#footer{
    position: relative;
    width: 100%;
    height: 60px;
}