2010-12-21 56 views
1

可能重复:
CSS sticky footer如何创建一个页脚其粘在屏幕的底部

嗨,

?我怎样才能创建一个页脚粘到屏幕底部(不是页面)尽管侧面有滚动条? 例如: http://www.sportingnews.com/

谢谢。

+2

[CSS粘的页脚](可能的重复http://stackoverflow.com/questions/3906065/ css-sticky-footer),加上[很多其他粘性页脚问题...](http://stackoverflow.com/search?q= [css] +粘性页脚)。 – 2010-12-21 21:45:30

回答

0

有几种方法,各有其自身的优势/劣势(尤其是浏览器的兼容性。)也许最简单的是固定的定位,这在IE6不工作。

.bar { 
    bottom: 0; 
    position: fixed; 
    z-index: 2; /* May need to be tweaked, depending on your design and functionality. */ 
}

如果您需要IE6的兼容性,您可以实现一个JS文件,它使IE6(及更多)支持IE6。退房ie7.js

0
<div style="position: fixed;bottom: 0px;">Footer text</div>