How can I increase a scrollbar's width using CSS?

后端 未结 6 1993
旧时难觅i
旧时难觅i 2020-12-02 22:32

Is it possible to increase the width of a scrollbar on a

element placed inside the ?

I am not talking about the def

6条回答
  •  一向
    一向 (楼主)
    2020-12-02 22:40

    This can be done in WebKit-based browsers (such as Chrome and Safari) with only CSS:

    ::-webkit-scrollbar {
        width: 2em;
        height: 2em
    }
    ::-webkit-scrollbar-button {
        background: #ccc
    }
    ::-webkit-scrollbar-track-piece {
        background: #888
    }
    ::-webkit-scrollbar-thumb {
        background: #eee
    }​
    

    JSFiddle Demo


    References:

    • Custom Scrollbars in WebKit | CSS-Tricks
    • WebKit scrollbar demo from CSS-Tricks
    • 15 Different scrollbar configurations

提交回复
热议问题