IE6 CSS bug: position:relative元素被overflow:auto/scroll元素包含

记个小笔记。今天做页面遇到的小问题。

BUG描述:

页面中某DIV使用了position:relative,结合top=-25px等元素定位。在FF和IE7下表现正常,但是在IE6中该DIV会随鼠标滚动而滚动。

分析:

这是IE6一个已知的BUG:当某position:relative元素 被带有overflow:auto/scroll属性的块级元素包含时,会表现出postion:absolute的行为。

解决方法:

1.为包含块元素添加属性position:relative 。

2.把该元素的position:relative属性去掉,使用默认的static定位,并通过margin-top等属性实现类似的效果。

Comments (3)

白纸对折九次八月 18th, 2009 at 6:32 下午

这个问题 应该就是触发了IE的hasLayout

记忆九月 30th, 2009 at 10:39 上午

路过,帮你踩踩!

web前端寒风七月 14th, 2010 at 1:38 下午

专业,css兼容方面还得想博主学学

Leave a comment

Your comment