为什么这个蓝色矩形在 Opera 和 Chrome 中的对齐方式不同?

发布于 2024-12-28 01:39:59 字数 321 浏览 1 评论 0原文

<div style="float:left; width:465px;">xxx</div>
<div style="width:320px; border:1px solid #099aef; position:absolute; display:inline;">Different position of this rectangle in Opera vs Google Chrome</div>

Opera 在左侧显示蓝色矩形,Chrome 显示不同。为什么? PS 代码被显着简化以发现错误,现在可能没有任何意义。

<div style="float:left; width:465px;">xxx</div>
<div style="width:320px; border:1px solid #099aef; position:absolute; display:inline;">Different position of this rectangle in Opera vs Google Chrome</div>

Opera displays the blue rectangle to the left, Chrome displays it different. Why?
P.S. The code was significantly simplified to find an error and may have no sense now.

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

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

发布评论

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

评论(1

邮友 2025-01-04 01:39:59

在没有位置坐标的情况下,Chrome 似乎会忽略您在第二个 div 上的绝对定位。相反,它将第二个 div 显示在第一个 div 的右侧,就像在正常页面流中一样。

It appears that Chrome is ignoring your absolute positioning on the second div in the absence of position coordinates. Instead, it's displaying the second div to the right of the first as if it was in the normal page flow.

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