响应式网页设计:div 宽度 +填充不会跨越包含 div,即使它们等于 100%
我有两个 div,都具有以下 css:
#div-id {
width:96%;
padding: 10px 2% 10px 2%;
}
现在,我希望这些 div 能够跨越整个包含的 div,它们在 Firefox 中也是如此,但它们在 webkit 浏览器中只跨越 99% 左右(还没有尚未在 IE 中测试)。
我需要做一些具体的事情才能使它们 100% 跨越 webkit 浏览器中的空间吗?
这是我在 bueddefeld.com/blog 上所做的工作(在 McDouble 汉堡之上)。
I've got two divs, both with the following css:
#div-id {
width:96%;
padding: 10px 2% 10px 2%;
}
Now, I expect these divs to span the entire containing div, and they do in Firefox, but they only go around 99% of the way across in webkit browsers (haven't tested in IE yet).
Is there something specific I have to do to make them span 100% across the space in webkit browsers?
Here's what I'm working with (overtop of the McDouble burger) at bueddefeld.com/blog.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是webkit 浏览器中的错误。这就是为什么建议您在创建响应式布局时使用 em 而不是百分比。 这是原始文章,其中包含获得真正响应式布局的推荐技术所有现代浏览器。
It's a bug in webkit browsers. That's why it's recommended you use ems instead of percentages when creating a responsive layout. Here's the original article with the recommended technique to get a truly responsive layout working across all modern browsers.