WebKit 和溢出:隐藏影响宽度

发布于 2024-09-12 07:58:26 字数 618 浏览 5 评论 0原文

我在 Google Chrome/Webkit 中遇到溢出和宽度问题。这是此问题的后续问题,在那里你会找到CSS。我需要有 visibility:hidden 来解决第一个问题中的问题。

该问题在下面的屏幕截图中可见。

为什么这个属性会影响Webkit中的宽度?我可以在没有令人讨厌的黑客攻击的情况下解决这个问题吗?或者我可以重新考虑右侧窗格的策略吗?

主 div 带有 overflow:visible。 div 被拉伸到右窗格,正如它应该的那样。

no Overflow

主 div 带有 overflow:hidden。右窗格现在影响主 div 的宽度。

溢出

I'm having a problem with overflow and width in Google Chrome/Webkit. This is a follow-up question on this question, there you will find the CSS. I need to have visibility: hidden to fix the problem in the first question.

The problem is visible in the screenshots below.

Why does this attribute affect the width in Webkit? Can I solve this without nasty hacks? Or can I re-think my strategy for the right pane?

Main div with overflow: visible. The div is stretched to the right pane, as it should be.

no overflow

Main div with overflow: hidden. The right pane is now affecting the main div's width.

overflow

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(1

二货你真萌 2024-09-19 07:58:26

这是由于“格式化上下文”: http://www.communitymx.com/content /article.cfm?cid=6BC9D

“浮动不会相互重叠,浮动也不会与建立新块格式化上下文的元素重叠。”

如果您使用溢出:隐藏在主 div 中创建新的块格式化上下文,则不再需要水平边距。

It's due to "formatting context" : http://www.communitymx.com/content/article.cfm?cid=6BC9D

"Floats don't overlap each other, and neither will a float overlap an element that establishes a new block formatting context."

If you use overflow: hidden to create a new block formatting context in the main div, you don't need the horizontal margins any more.

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