Strange z-index behavior with scrollbars under Chrome

后端 未结 2 1336
难免孤独
难免孤独 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: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;
    }
    

提交回复
热议问题