Scrollbar track thinner than thumb

后端 未结 9 1446
时光说笑
时光说笑 2021-02-19 10:39

I am trying to style a scrollbar using css and I want to achieve the following look (ignore the background):

In other words, I want the thumb to be thicker than

9条回答
  •  情书的邮戳
    2021-02-19 11:31

    There are 7 different scrollbar options to use:

    ::-webkit-scrollbar {/ * 1 - scrollbar * /}
    ::-webkit-scrollbar-button {/ * 2 - button * /}
    ::-webkit-scrollbar-track {/ * 3 - track * /}
    ::-webkit-scrollbar-track-piece {/ * 4 - the visible part of the track */}
    ::-webkit-scrollbar-thumb {/ * 5 - slider * /}
    ::-webkit-scrollbar-corner {/ * 6 - corner * /}
    ::-webkit-resizer {/ * 7 - resizing * /}
    

    For what you're trying to achieve, you can do this:

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

提交回复
热议问题