CSS 粘性页脚菜单 - 检查元素时布局损坏
我制作了一个 css 粘性页脚菜单,除了当您使用 FF 检查元素时,页脚菜单会向上跳跃约 100px 之外,该菜单运行良好。因此,当 Firebug 窗口可见时,菜单会浮动在页面的中间!?
我已将 body 和 html 设置为高度 100%,而且我还有一个高度为 100% 的容器 div...有什么想法吗?
编辑:我刚刚尝试将容器 div 设置为溢出:自动。菜单不再浮动在页面中间,但我有垂直滚动条?
相关CSS:
#menu {
width: 960px;
height: 100px;
position: absolute;
bottom: 0px;
background-color: rgba(65, 64, 64, 0.75);
-webkit-border-top-left-radius: 10px;
-webkit-border-top-right-radius: 10px;
-moz-border-radius-topleft: 10px;
-moz-border-radius-topright: 10px;
border-top-left-radius: 10px;
border-top-right-radius: 10px;
}
i have made a css sticky footer menu which is working great apart from when you Inspect Element with FF, the footer menu jumps up about 100px. So when the Firebug window is visible the menu is floating halfway up the page!?
I have set body and the html to height 100% and also i have a container div which has height 100% aswell...Any ideas?
EDIT: I have just tried setting the container div to overflow: auto. The menu no longer float halfway up the page but i have vertical scrollbars??
Relevant CSS:
#menu {
width: 960px;
height: 100px;
position: absolute;
bottom: 0px;
background-color: rgba(65, 64, 64, 0.75);
-webkit-border-top-left-radius: 10px;
-webkit-border-top-right-radius: 10px;
-moz-border-radius-topleft: 10px;
-moz-border-radius-topright: 10px;
border-top-left-radius: 10px;
border-top-right-radius: 10px;
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
跨浏览器 CSS 粘性页脚不可能用单一规则来实现。我敢打赌这在 IE 中行不通。对于坚如磐石的 css 粘性页脚工具,请查看此处
Cross browser CSS sticky footers are impossible to do with a single rule. I would hazard a bet this will not work in IE. For a rock solid css sticky footer implement take a look here
您必须考虑到,当 firebug 加载时,它实际上会在其中发布自己的样式以突出显示元素。您可以尝试在 Chrome/Safari 中检查该元素,以减少侵入性的突出显示。
希望这有帮助。
You have to take into consideration, when firebug is loading it actually posts it's own styles in there to highlight element(s). You can try inspecting the element in Chrome/Safari for a less invasive highlighting.
Hope this helps.
您应该将菜单放在容器外部的 正下方
you should have your menu outside of your container directly below <body>