Apply webkit scrollbar style to specified element

前端 未结 3 1310
悲&欢浪女
悲&欢浪女 2020-12-04 23:04

I am new to pseudo-elements that are prefixed with a double colon. I came across a blog article discussing styling of scrollbars using some webkit only css. Can the pseudo-e

3条回答
  •  星月不相逢
    2020-12-04 23:30

    You can also apply these rules by id of the element. Let's say scroll bar of a div has to be styled which has an id "myDivId". Then you can do following. This way you can use different styles for scroll bars of different elements.

    #myDivId::-webkit-scrollbar {
        width: 12px;
    }
    
    #myDivId::-webkit-scrollbar-track {
        -webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.3); 
        border-radius: 10px;
    }
    
    #myDivId::-webkit-scrollbar-thumb {
        border-radius: 10px;
        -webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.5); 
    }
    

    http://jsfiddle.net/QcqBM/516/

提交回复
热议问题