jquery - z-index not working on child div with position absolute -


i trying create ribbon triangle div should placed below cart parent div

<div class="rectangle">   <ul class="dropdown-menu font_size_12" role="menu" aria-labelledby="menu1" style="min-width: 100px; z-index: 0">     <li role="presentation">        <a role="menuitem" tabindex="-1" href="#">sign in </a>     </li>     <li role="presentation">        <a rolw="menuitem" tabindex="-1" href="#">view cart</a>     </li>   </ul>   <!-- ribbon side-fold (left , right) -->   <div class="triangle-l triangle-left-pos"></div>   <div class="triangle-r triangle-right-pos"></div> </div> 

and js fiddle here problem , child div not getting placed under parent div, in fiddle, div placed above, though have given z-index lesser parent div.

edit :- adding image, child div should placed

ribbon image

stacking contexts treated atomically single unit in parent stacking context.

the parent element .rectangle has created stacking context, children elements' z-index resolved within .rectangle, cannot placed under parent.

if move z-index property of .rectangle element, , apply negative z-index value children can placed wished. because in case, both parent element , children elements belonging same stacking context(#root in demo), , negative z-index order let children stay lower parent in z axis.

but remember, if apply css3 transform, or make opacity transition of parent element, new stacking context created , rendered same in demo.

ref: the stacking context


Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -