Chrome 神秘地将页脚宽度增加了 3px
我网站的页脚 Atlantic Sentinel 的宽度指定为 960px,最大宽度也指定960 像素。在 IE 中看起来不错,但 Chrome 增加了 3px 的宽度。为什么,我想不通。
这是相关的 CSS:
#colophon {
clear: both;
display: table;
width: 960px;
max-width: 960px;
background: #131313;
overflow: hidden;
border-top: 3px solid #0099cc;}
#colophon .widget {
display: table-cell;
float: left;
width: 22%;
margin: 2em 0 2em 2em;
background: #000;
color: #ccc;
text-align: justify;}
它不是小部件上的边距。我尝试删除一个,所以只有 3 个小部件,宽度为 22%,而额外的 3px 仍然存在于 Chrome 中。
我缺少什么?
The footer at my site Atlantic Sentinel has a width specified at 960px and a max-width also at 960px. It looks fine in IE but Chrome adds 3px to the width. Why, I can't figure it out.
Here's the relevant CSS:
#colophon {
clear: both;
display: table;
width: 960px;
max-width: 960px;
background: #131313;
overflow: hidden;
border-top: 3px solid #0099cc;}
#colophon .widget {
display: table-cell;
float: left;
width: 22%;
margin: 2em 0 2em 2em;
background: #000;
color: #ccc;
text-align: justify;}
It's not the margins on the widgets. I've tried removing one, so there's only three widgets, 22% wide, and the extra 3px is still there in Chrome.
What am I missing?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
删除
display: table;
规则。这是不必要的,您不需要将其更改为诸如display: block
之类的其他内容,因为这是默认值,并且您不会在示例中覆盖它。Remove the
display: table;
rule. It's unnecessary, and you don't need to change it to anything else likedisplay: block
since that's the default and you're not overriding that in your example.尝试用
display:inline;
代码代替display: table-cell;
然后看看你是否已经实现了???try
display:inline;
code instead ofdisplay: table-cell;
and then see if you have achieved???这似乎是 webkit 中的一个错误,要修复它,只需将页脚设置为显式折叠添加到页脚顶部的边框,如下所示:
确保删除
overflow:hidden
声明,因为它不再需要了。编辑。是的,一个错误。设法在这里重新创建它, http://jsfiddle.net/PnYPr/ 。与 webkit 中的 OP 的问题相同。将提交错误报告。
编辑2.错误报告。
This seems to be a bug in webkit, to fix it just set your footer to explicitly collapse the borders you added to the top of your footer like so:
Make sure to remove the
overflow:hidden
declaration as it is not needed anymore.EDIT. Yup, a bug. Managed to recreate it here, http://jsfiddle.net/PnYPr/ . Same problem as OP's in webkit. Will submit a bug report.
EDIT 2. Bug reported.