Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The reason <code>static</code> works is because <code>z-index</code> is only applied to positioned elements - <code>absolute</code>, <code>relative</code>, <code>fixed</code>.</p> <p>I believe in this instance, IE may have got the <code>z-index</code> right. The problem you are describing sounds like the <code>checkbox</code> is being placed behind the parent element in Chrome, FF, Safari and Opera.</p> <p>The following text extract from <a href="http://www.w3.org/TR/CSS2/visuren.html#z-index" rel="noreferrer">W3.org</a> descibes the order in which the z-index elements are drawn:</p> <blockquote> <p>Within each stacking context, the following layers are painted in back-to-front order:</p> <ol> <li><p>the background and borders of the element forming the stacking context.</p></li> <li><p>the child stacking contexts with negative stack levels (most negative first).</p></li> <li><p>the in-flow, non-inline-level, non-positioned descendants.</p></li> <li><p>the non-positioned floats.</p></li> <li><p>the in-flow, inline-level, non-positioned descendants, including inline tables and inline blocks.</p></li> <li><p>the child stacking contexts with stack level 0 and the positioned descendants with stack level 0.</p></li> <li><p>the child stacking contexts with positive stack levels (least positive first).</p></li> </ol> </blockquote> <p>However, it sounds like Chrome, FF, Safari and Opera could be drawing the negative z-index elements (2) before the parent element's background (1).</p> <p>In any case, as you can see, the negative <code>z-index</code> elements are pretty near the bottom of the pile, so if an element requires any kind of user interaction then a negative <code>z-index</code> is probably not the best choice.</p> <p><b>Additional Note</b></p> <p>Another reason it could be working in IE and not the others is that IE tends to treat "empty" elements as if they do not exist. So if there is something drawn above the <code>checkbox</code> but it contains nothing (no background, content etc) then IE will ignore it and allow interaction with the element below - where the other browsers will not.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload