如何将页脚(div)对齐到页面底部? [英] How to align footer (div) to the bottom of the page?

查看:421
本文介绍了如何将页脚(div)对齐到页面底部?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

任何人都可以解释如何将页脚div对齐到页面底部。从我看过的例子,他们都显示如何让div保持在底部可见,无论你在哪里滚动页面。虽然我不想这样。我想把它固定在页面的底部,所以它不移动。感谢帮助!

Can anyone explain how to align a footer div to the bottom of the page. From the examples I've seen, they all show how to make the div stay visible at the bottom, no matter where you've scrolled the page. Although I don't want it like that. I want it fixed at the bottom of the page, so it doesn't move. Appreciate the help!

推荐答案

这是什么意思?

http://ryanfait.com/sticky-footer/


此方法仅使用15行CSS,几乎不使用任何HTML标记。更好的是,它是完全有效的CSS,它适用于所有主流浏览器。 Internet Explorer 5及更高版本,Firefox,Safari,Opera等。

This method uses only 15 lines of CSS and hardly any HTML markup. Even better, it's completely valid CSS, and it works in all major browsers. Internet Explorer 5 and up, Firefox, Safari, Opera and more.

此页脚将永久保留在页面底部。这意味着如果内容大于浏览器窗口的高度,则需要向下滚动才能看到页脚...但是如果内容小于浏览器窗口的高度,页脚将会粘到底部

This footer will stay at the bottom of the page permanently. This means that if the content is more than the height of the browser window, you will need to scroll down to see the footer... but if the content is less than the height of the browser window, the footer will stick to the bottom of the browser window instead of floating up in the middle of the page.

这是另一个也许更好的解决方案:

Here's another, perhaps better, solution:

http://www.cssstickyfooter.com/

让我知道如果你需要帮助的实现。我希望这有助于。

Let me know if you need help with the implementation. I hope this helps.

这篇关于如何将页脚(div)对齐到页面底部?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆