z-index为什么.box1 .inner不在.box2之上?
z-index为什么.box1 .inner不在.box2之上?
有没有关于z-index详细讲解的文章,包括测试代码的。
<!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"><head><title>page title</title><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /></head><body> <style type="text/css"> .box1,.box2,.box3,.inner{width:200px;height:200px;} .box1{background-color:red;position:relative;z-index:1;} .box2{background-color:green;position:relative;z-index:1;top:-30px;left:50px;} .box3{background-color:tan;} .inner{background-color:#3A80F3;position:absolute; left:20px;top:20px;z-index:1000;} </style> <div class="box1"> box1 z-index:1; <div class="inner">box1 inner z-index:1000</div> </div> <div class="box2">box2 z-index:1</div> <div class="box3"></div></body></html>