CSS 问题 - 页脚太长?
我在该网站的页脚方面遇到了一些问题。我正在寻找它有一个设定的最小高度并流到页面底部,无论分辨率如何。有点像粘性页脚,但我希望它能抵住其上方容器 div 的末端。
该问题在所有现代浏览器(Safari、Chrome、IE 和 Firefox)中都是一致的。
CSS 太多,无法在此处发布,但 Firebug 或视图源将显示相应的样式。任何帮助将不胜感激。
I'm having a bit of a problem with the footer on this site. I am looking for it to have a set minimum height and flow to the bottom of the page no matter the resolution. Kind of like a sticky footer but I want it to butt up against the end of the container div above it.
The issue is consistent across all modern browsers (Safari, Chrome, IE, and Firefox).
Too much CSS to post here but Firebug or a view source will show the corresponding styling. Any help would greatly appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
感谢您的屏幕截图。你的描述现在更有意义了。我会做以下事情。现在你有类似的事情
我会考虑这样的事情
基本上我们所做的是将正文和页面设置为 100%,这意味着它们占据整个屏幕。页面使用与页脚相同的背景颜色。最后,我们将 header 和 bodycontent 设置为黑色背景,以便它们覆盖页面的灰色。
Thanks for the screenshot. Your description makes more sense now. I would do the following. Right now you have something like
I would consider something like this
Basically what we do is set body and page to 100% which means they take up the entire screen. Page uses the same bg color as the footer. Finally we set header and bodycontent to have black backgrounds so that they cover up the Page's gray.
在页脚上指定 100% 高度并没有达到您的预期。您告诉它您希望高度为身体的 100%,它不仅仅“扩展以填充”剩余空间。它实际上是 100% 高度,加上您添加的所有其他内容。它达到了 150 像素或更高的最小高度。
Specifying 100% height on the footer is not doing what you think it does. You're telling it that you want the height to be 100% of the body, it doesn't just "expand to fill" the remaining space. It will actually be 100% height, plus everything else you've added in. It is achieving your minimum height of 150px and more.
尝试在 css 中进行以下更改:
try this changes in you css:
我遇到了类似的问题,它应该如下所示:
HTML
CSS
I was having a similar issue, it should look like this:
HTML
CSS