响应式网页设计:div 宽度 +填充不会跨越包含 div,即使它们等于 100%

发布于 2025-01-04 05:59:50 字数 361 浏览 3 评论 0原文

我有两个 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

任谁 2025-01-11 05:59:50

这是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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文