Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/80.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ruby-on-rails-4/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Browser IE7+和opera中的z索引问题_Browser_Html_Positioning_Z Index - Fatal编程技术网

Browser IE7+和opera中的z索引问题

Browser IE7+和opera中的z索引问题,browser,html,positioning,z-index,Browser,Html,Positioning,Z Index,以下是html: <div id = "parent"> <div id = "one" ></div> <div id = "two" ></div> </div> ie7+和opera中的问题是div one没有重叠div two,为什么会这样?尝试使用以下方法: <div id = "parent"> <div class= "one" ></div> &l

以下是html:

<div id = "parent">
   <div id = "one" ></div>
   <div id = "two" ></div>
</div>
ie7+和opera中的问题是div one没有重叠div two,为什么会这样?

尝试使用以下方法:

<div id = "parent">
   <div class= "one" ></div>
   <div class= "two" ></div>
</div>
css:

#parent
{
  position:    relative;
width: 150px;
height: 150px;
background: yellow;
}
   #parent  .one
   {
     position:  absolute;
     z-index:   10;
     top:       50px;
     left:      50px;  
     width:     100px;
     height:    100px;
     background:  white;        
   }
   #parent .two
   {
     position:  absolute;
     z-index:   5;
     top:       50px;
     left:      50px;
     height:    50px;
     width:     50px;
     background: black;
   }

希望你能得到线索

将id更改为类与任何事情有什么关系?是否有效?如果未工作,则发送其输出的屏幕截图
<div id = "parent">
   <div class= "one" ></div>
   <div class= "two" ></div>
</div>
css:

#parent
{
  position:    relative;
width: 150px;
height: 150px;
background: yellow;
}
   #parent  .one
   {
     position:  absolute;
     z-index:   10;
     top:       50px;
     left:      50px;  
     width:     100px;
     height:    100px;
     background:  white;        
   }
   #parent .two
   {
     position:  absolute;
     z-index:   5;
     top:       50px;
     left:      50px;
     height:    50px;
     width:     50px;
     background: black;
   }