Scrollbar track thinner than thumb

后端 未结 9 1443
时光说笑
时光说笑 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:34

    Simple CSS solution to show handle thicker than track. It works fine in Chrome only. It may help for someone who needs this.

    /* To set scrollbar width */
    ::-webkit-scrollbar {
      width: 5px;
    }
    
    /* Track */
    ::-webkit-scrollbar-track {
      background: #f1f1f1; 
      border-radius: 9px;
      border: 2px solid white;  /* Use your background color instead of White */
      background-clip: content-box;
    }
    
    /* Handle */
    ::-webkit-scrollbar-thumb {
      background: #888; 
      border-radius: 9px;
    }
    
    /* Handle on hover */
    ::-webkit-scrollbar-thumb:hover {
      background: #555; 
    }
    

提交回复
热议问题