我有一个简单的两列布局,带有一个页脚,可以清除标记中的右div和左div.我的问题是,我不能让页脚在所有浏览器中都停留在页面底部.如果内容将页脚向下推,它会起作用,但情况并非总是如此.
我有一个简单的两列布局,带有一个页脚,可以清除标记中的右div和左div.我的问题是,我不能让页脚在所有浏览器中都停留在页面底部.如果内容将页脚向下推,它会起作用,但情况并非总是如此.
要获得粘性页脚,请执行以下操作:
你的内容有<div>
分和class="wrapper"
分.
右before wrapper
个位置的尾部</div>
<div class="push"></div>
.
右图after wrapper
的最后</div>
位
* {
margin: 0;
}
html, body {
height: 100%;
}
.wrapper {
min-height: 100%;
height: auto !important;
height: 100%;
margin: 0 auto -142px; /* the bottom margin is the negative value of the footer's height */
}
.footer, .push {
height: 142px; /* .push must be the same height as .footer */
}