嵌套 div 100% 高度,带粘性页脚
我有一个 #main
div 嵌套在容器 div 中,我想将页面填充到粘性页脚。我尝试了几个角度,但似乎无法使其发挥作用。如果你不使用 firebug,只需询问,我会提供 CSS 等。
谢谢。
I have a #main
div nested within a container div that I want to fill the page down to the sticky footer. I've tried several angles, but can't seem to get it to work. If you don't use firebug, just ask and I'll provide CSS, etc.
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我曾多次尝试做粘页脚,但我似乎从来没有意识到它们真的很难做到。你的情况看起来很复杂,而且你现在的情况看起来也不错。
我想我会使用 JavaScript 来检测页面大小调整并适当调整高度。或者,或者对跨越页脚和#main 的背景图像做一些棘手的事情。
这可能不是你想听到的,但对于只使用 CSS 来说这是一个棘手的问题 - 比我愿意投资的更难。
I've tried to do sticky footer many times and I never seem to learn that they are really hard to do. Your situation seems complicated and what you have now doesnt seem half bad.
I think I would use JavaScript to detect page resize and adjust the heights appropriately. Either that, or do something tricky with background images spanning both the footer and #main.
That's probably not what you want to hear but this is a tough problem for only using CSS - tougher than I would care to invest in.
使用 Jquery
http://css-tricks.com/snippets/jquery/jquery-sticky- footer/
或仅 css:
http://www.cssstickyfooter.com /using-sticky-footer-code.html
或
http: //www.pmob.co.uk/temp/sticky-footer-ie8new.htm
With Jquery
http://css-tricks.com/snippets/jquery/jquery-sticky-footer/
or css only:
http://www.cssstickyfooter.com/using-sticky-footer-code.html
or
http://www.pmob.co.uk/temp/sticky-footer-ie8new.htm