问题:

使用CSS/HTML实现的页面的页脚不能够一直停留在页面底部,当页面内容较少时,页脚就会显示在屏幕的中部,而我希望当页面内容较少的时候,页脚能够一直停留在页面底部,同时当页面内容较多时,页脚正常状态显示。

解决方案:

CSS粘性页脚(CSS Sticky Footer)。


以下是我从网上找到的几个解决方案,感觉可能大同小异,但目前我对CSS也是一知半解,就都列出来吧。

  1. Making Your Footer Stay Put With CSS
  2. Make the Footer Stick to the Bottom of a Page
  3. CSS Making Your Footer Stay at the Bottom
  4. How to keep footers at the bottom of the page

其中第二个不需要使用额外的文件就能够兼容IE6,我想其使用的方法应该可以应用到其他的解决方案中(未验证)。相对来说,我更喜欢第四个解决方案。

Gonna Sailing 😉 ==END==