工作,我有像这样一些div:CSS的z-index不与相对定位
<html>
<body>
<div id="out">
<div id="in">
<div id="one" style="position: relative; z-index: 3">
</div>
<div id="two" style="position: relative; z-index: 2">
</div>
<canvas id="three" style="position: relative; z-index: 1">
</canvas>
<canvas id="four" class="hidden">
</canvas>
</div>
<-- Some more divs with position: static (default)-->
</div>
</body>
</html>
我想#one (stacked over) #two (stacked over) #three
,但我得到的是#one (before) #two (before) #three
只是因为它们将出现不施加任何的z-index。我怎样才能使我的Z指数工作,更重要的是为什么我的代码不工作?
你'div's是'的位置是:相对的;'但你不他们不会将它们移动到任何地方,所以它们就像通常一样渲染。你需要用'top'和'left'移动它们,或者将它们放在容器内。 – Quantastical
可能重复[如何使用z-index与相对定位?](http://stackoverflow.com/questions/8986071/how-to-use-z-index-with-relative-positioning) – Matthijs
@Mathhijs:我看到了问题,但在那里,位置:相对于两个div在相同堆栈级别IMO。我认为我的情况更容易解决! –