Change size of scrollbar thumb with CSS

后端 未结 8 563
旧巷少年郎
旧巷少年郎 2020-12-30 03:21

I want to get a scrollbar with a thumb larger than the track. I can change the color, the opacity, everything, but I don\'t know how to change the size of the thumbs and the

8条回答
  •  臣服心动
    2020-12-30 04:08

    To make the thumb smaller than the track/scrollbar, simply add a border to the thumb having the same color as the track.

    http://jsfiddle.net/Swiftaxe/75pmwmfw/

    .wrapper {
        overflow: auto;
        background: white;
        max-height: 90px;
        width: 400px;
        padding: 20px 30px;
    }
    
    .wrapper::-webkit-scrollbar{
      width: 18px;
      border-radius: 20px;
    }
    
    .wrapper::-webkit-scrollbar-track{
      background: #CCEEF4;
      border-radius: 20px;
    }
    ::-webkit-scrollbar-thumb{
      width: 24px;
      background: #49AEC0;
      border: 5px solid #CCEEF4;
      border-radius: 15px;
    }

    Scrolling is a Virtue

    Well, it's not the first time. About it! There; keep thy finger on it. This is a cogent vice thou hast here, carpenter; let me feel its grip once. So, so; it does pinch some. Oh, sir, it will break bones—beware, beware! No fear; I like a good grip; I like to feel something in this slippery world that can hold, man.

    If the track needs to be transparent one can use background-clip.

    Unable to set the width of webkit-scrollbar-thumb

提交回复
热议问题