Strange z-index behavior with scrollbars under Chrome

后端 未结 2 1335
难免孤独
难免孤独 2021-02-02 08:48

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

相关标签:
2条回答
  • 2021-02-02 09:29

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

    0 讨论(0)
  • 2021-02-02 09:49

    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;
    }
    
    0 讨论(0)
提交回复
热议问题