I am experiencing a very annoying error that seems to occur only on Windows and OS X: the z-index of an element whose parent has a fixed position does not work in Chrome! I converted my strange situation to simple code:
HTML:
<div id="mask"> </div> <div id="box"> <div class="below-mask circle"> should be below the mask </div> <div class="above-mask circle"> should be above the mask </div> </div>β
CSS
body { font-family: Verdana; font-size: 9px; margin: 0px; } #box { position: fixed; } #mask { position: absolute; left: 0px; top: 0px; background-color: rgba(0, 0, 0, 0.5); width: 100%; height: 100%; z-index: 9998; } .circle { position: relative; background-color: rgba(255, 204, 0, 0.75); border-radius: 75px; line-height: 150px; margin: 50px; text-align: center; width: 150px; height: 150px; } .above-mask { z-index: 9999; } .below-mask { z-index: 9997; }β
sandbox: http://jsfiddle.net/gibatronic/umbgp/
I tested in Internet Explorer 9, Firefox 15, Opera 12.02, and Safari 5.1.7 on OS X and Windows, and they all displayed as expected. I also tested Ubuntu 12.10 and it worked perfectly for every browser, including Chrome! I even tested in the Kindle 4 browser and it works!
I wonder if anyone knows any solution to fix this problem?
css google-chrome z-index
gibatronic
source share