最简单的就是:
position:fixed;
bottom:0
其实这是很搓的做法,为什么?当我页面比较短的时候,这个div是位于底部的,但是当我页面比较长的时候,这个div/footer就会覆盖内容页,浮在上面了。那怎么办?看我的,哇哈哈:
* {
margin: 0;
}
html, body {
height: 100%;
}
.wrapper {
min-height: 100%;
margin: 0 auto -60px; /* -60pxthe bottom margin is the negative value of the footer's height */
}
footer, .push {
height: 60px; /* '.push' must be the same height as 'footer' */
}
看到没有,只要body里面放一个div class=wrapper,然后后面加一个footer就搞定了, 最主要是-60px这个参数。自己去检察元素看看就知道了。