There are two containers. One is fixed and covers 100% of the screen. Second is relative - contains scrollable content. The problem is that there are four elements to be positioned relative to each other as follows: 1st in a fixed container, 2nd in absolute, 3rd fixed, 4th in absolute.
<div class="container fixed">
<div class="el z1"></div>
<div class="el z3"></div>
</div>
<div class="container relative">
<div class="el z2"></div>
<div class="el z4"></div>
</div>
However, z-index of one of the parents will always be less than the other, which not allow to do order for 4 children elements.
There is fiddle http://jsfiddle.net/only_dimon/zkY4C/6/ I want order: yellow, green, white, black from bottom. But as you can see - yellow, white, green, black.
The result I want:
But elements should be in different containers.
Thanks in advance!
This helps for me: For many elements helps only html reconstruction. Luckily I don't need to use fixed container for fixed elements, because fixed element's position and sizes depends on window size, even if I put them into relative container.