负值的z-index在IE在与FF的区别

ie下
给body元素默认了一个绝对定位属性(position: absolute)z-index其值无限小。663cb86f
FF下
body和html (被定义了样式属性时) 元素默认了一个绝对定位属性(position: absolute)不过他们的z-index是0。
当body的z-index值为负的时候,body内的元素z-index值再大也不会冲破他的束缚,如果body外的元素(html)定义了样式属性时,body也不会冲破这个元素的束缚。
 
所以在z-index 为-1时 在IE和FF中的显示是不一样的,是IE的bug。
下面是测试代码:
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<style>
#box1 { position: absolute; top: 100px; left: 210px; width: 200px; height: 200px; background-color: yellow; z-index: -10; }
</style>
<body>
<div id="box1">为什么负值的定位元素在IE和FF下显示不一致呢?Why?</div>
</body>
</html>
 
版权所有© HzlzH | 本文采用 BY-NC-SA 进行授权
转载需注明 转自: 《负值的z-index在IE在与FF的区别

随机文章

{ Leave a Reply ? }

  1. lala China Opera Mini FreeBSD

    标准实在难统一

  2. bolo China Maxthon Windows

    ie是个css白痴,令人很烦的东西

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="" highlight="">

:wink: :twisted: :roll: :oops: :mrgreen: :lol: :idea: :evil: :cry: :arrow: :?: :-| :-x :-o :-P :-D :-? :) :( :!: 8-O 8)