Strange z-index behavior with scrollbars under Chrome

Vincent Batoufflet picture Vincent Batoufflet · Jun 1, 2013 · Viewed 22.7k times · Source

Using z-index CSS property on 'fixed' positioned elements gives me a strange behavior under Chrome.

When Firefox and Opera browsers give me the awaited result, Chrome does not seem to respect the z-index property, displaying the scrollbar above the red overlay (see code and Fiddle bellow).

HTML:

<div class="left">
    <div class="placeholder"></div>
</div>
<div class="right"></div>
<div class="overlay"></div>

CSS:

.left {
    background-color: yellow;
    bottom: 0;
    left: 0;
    overflow: auto;
    position: fixed;
    top: 0;
    width: 35%;
    z-index: 10;
}

.right {
    background-color: orange;
    bottom: 0;
    position: fixed;
    right: 0;
    top: 0;
    width: 65%;
    z-index: 20;
}

.overlay {
    background-color: red;
    bottom: 20%;
    left: 25%;
    position: fixed;
    right: 25%;
    top: 20%;
    z-index: 40;
}

.placeholder {
    height: 3000px;
}

Example: http://jsfiddle.net/kvNFW/

OS: Apple Mac OS 10.8 Google Chrome: Version 27.0.1453.93

Is there someone having experienced the same issues, or having a way to fix that?

Thanks in advance for any help.

Edit:

See this screenshot for an overview of the issue.

Answer

jackysee picture jackysee · Apr 1, 2014

You may try to add -webkit-transform: translate3d(0, 0, 0). It solves my similar problem happened in mobile chrome.