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.
A quick fix is to add overflow: hidden to the CSS for your #footer . Note: A scrollbar will still appear if your #body content flows out of the the viewport. Show activity on this post. It will remove unnecessary scroll bars.
Chrome DevTools: Scroll elements into the viewportRight click on the DOM node from the elements panel. Select Scroll into view.
The easy fix is to use width: 100% instead. Percentages don't include the width of the scrollbar, so will automatically fit. If you can't do that, or you're setting the width on another element, add overflow-x: hidden or overflow: hidden to the surrounding element to prevent the scrollbar.
We call those overlay scrollbars and they are either partially or fully transparent while sitting on top of the page content. In other words, unlike classic scrollbars that take up physical real estate on the screen, overlay scrollbars sit on top of the screen content.
You may try to add -webkit-transform: translate3d(0, 0, 0)
. It solves my similar problem happened in mobile chrome.
I had some similar issues, and the only way to resolve I found was to apply some special styles to the webkit scrollbar in order to show it always. See http://jsfiddle.net/sinspiral/pTkQL/ with your example fixed.
This is not platform compatible (as on windows it will apply those styles too), so you might need to find a way, maybe js, to detect on which OS it is running.
.left::-webkit-scrollbar{ -webkit-appearance: none; } .left::-webkit-scrollbar-thumb { background-color: rgba(50, 50, 50, .5); border: 3px solid transparent; border-radius: 9px; background-clip: content-box; } .left::-webkit-scrollbar-track { background-color: rgba(100, 100, 100, .5); width: 15px; }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With