Internet Explorer overflow bug

Internet Explorer 6 和 7 在处理相对定位元素时存在一个错误,即这些元素会被错误地叠加到页面上的所有其他元素之上,呈现出一种“固定”的外观。此问题尤其发生在带有 'overflow:auto' 的容器中。解决此问题的简单方法是在包含块上应用 'position:relative'。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Internet Explorer - Bug Report

This bug relates to the handling of relatively positioned elements inside an overflow box.
Applies to:

* CSS
* (X)HTML
* IE6 and IE7

W3 states:

9.4.3 Relative positioning

Once a box has been laid out according to the normal flow or floated, it may be shifted relative to this position. This is called relative positioning. Offsetting a box (B1) in this way has no effect on the box (B2) that follows: B2 is given a position as if B1 were not offset and B2 is not re-positioned after B1's offset is applied. This implies that relative positioning may cause boxes to overlap. However, if relative positioning causes an 'overflow:auto' box to have overflow, the UA must allow the user to access this content, which, through the creation of scrollbars, may affect layout.

Internet Explorer incorrectly overlays the relatively positioned element over all other elements on the page, giving it a "fixed" appearance when scrolling inside an overflow box.
The workaround

What's a bug report without a solution?

The simplest fix is to apply position: relative to the containing block; the one with overflow: auto.

http://www.rowanw.com/bugs/overflow_relative.htm
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值