什么是保持页脚始终位于底部的最佳方式

时间:2012-10-16 14:29:28

标签: html css styles footer

我有这个网站:http://test.tamarawobben.nl

实现页脚始终位于屏幕底部的最佳方法是什么?

3 个答案:

答案 0 :(得分:1)

这取决于你的意思"总是在底部"。有两种类型的页脚,总是在底部":固定和粘性。

固定页脚始终位于浏览器窗口的底部 ,其中粘性页脚始终位于页面内容或浏览器的底部,以较低者为准

对于粘性页脚,您可以查看代码on this page。对于固定页脚,您只想为其提供以下属性:

#footer {
    position: fixed;
    bottom: 0px;
}

答案 1 :(得分:0)

页脚的CSS

footer {
   position:absolute;
   bottom:0;
   width:100%;
   height:60px;   /* Height of the footer */
   background:#6cf;
}

关于此的完整文章:How to keep footers at the bottom of the page

答案 2 :(得分:0)

请参阅本教程,了解如何执行此操作 - http://matthewjamestaylor.com/blog/keeping-footers-at-the-bottom-of-the-page

应该得到你想要的东西。