How to change the scrollbar styles in Angular Material select?

前端 未结 4 1321
萌比男神i
萌比男神i 2021-02-07 19:48

We need help in changing the scrollbar in the Select component from Angular Material.

The following demo was implemented.

https://stackblitz.com/angular/bxbvndrp

4条回答
  •  萌比男神i
    2021-02-07 20:44

    Usually the way to customize the scroll is:

    /* width */
    ::-webkit-scrollbar {
        width: 20px;
    }
    
    /* Track */
    ::-webkit-scrollbar-track {
        box-shadow: inset 0 0 5px grey; 
        border-radius: 10px;
    }
    
    /* Handle */
    ::-webkit-scrollbar-thumb {
        background: red; 
        border-radius: 10px;
    }
    
    /* Handle on hover */
    ::-webkit-scrollbar-thumb:hover {
        background: #b30000; 
    }
    

    You cannot directly inspect the scroll from the dev tools, however you can see the styling of it if you inspect the div that has the overflow property with the scroll; value in it.

提交回复
热议问题