I am working with bootstrap 4. I would like to know if there is a way to change the scrollbar style. I just tried with webkit mode, but does not work.
            Asked
            
        
        
            Active
            
        
            Viewed 4.7k times
        
    5
            
            
        - 
                    The scrollbar style is browser specfic and nothing to do with Bootstrap. – Carol Skelly Feb 08 '17 at 13:58
- 
                    Dup of: http://stackoverflow.com/questions/9251354/css-customized-scroll-bar-in-div – Carol Skelly Feb 08 '17 at 14:13
- 
                    @ZimSystem i just tried with those methods, but i dont know why doesnt works – flipps Feb 08 '17 at 14:25
- 
                    They seem to work as expected: http://www.codeply.com/go/fLHwymIPdT – Carol Skelly Feb 08 '17 at 14:30
3 Answers
16
            
            
        The following code will works for webkit
::-webkit-scrollbar {
    width: 12px;
}
::-webkit-scrollbar-track {
    -webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.3); 
    border-radius: 10px;
}
::-webkit-scrollbar-thumb {
    border-radius: 10px;
    -webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.5); 
}
 
    
    
        Brad Larson
        
- 170,088
- 45
- 397
- 571
 
    
    
        Bhoot Biswas
        
- 192
- 7
7
            
            
        Bhoot's code above works, but I added a backgound-color for the thumb because I am using a dark background.
::-webkit-scrollbar {
    width: 12px;
}
::-webkit-scrollbar-track {
    -webkit-box-shadow: inset 0 0 6px rgba(200,200,200,1);
    border-radius: 10px;
}
::-webkit-scrollbar-thumb {
    border-radius: 10px;
    background-color:#fff;
    -webkit-box-shadow: inset 0 0 6px rgba(90,90,90,0.7);
}
 
    
    
        Fyodor Soikin
        
- 78,590
- 9
- 125
- 172
 
    
    
        davaus
        
- 1,145
- 13
- 16
6
            
            
        If you are trying on any div or elements for scroll bar customization, please assign and use element id in the CSS as below,
<div class="cardsContainer" id="cards-container">
#cards-container::-webkit-scrollbar {
    width: 8px;
    background-color: #F5F5F5;
}
#cards-container::-webkit-scrollbar-track {
    box-shadow: inset 0 0 6px rgba(104, 140, 240, 0.3);
  }
#cards-container::-webkit-scrollbar-thumb {
    background-color: lightblue;
    outline: 1px solid slategrey;
}
The above way, it worked for me, even though it didn't work when I tried as follows,
::-webkit-scrollbar {
    width: 12px;
}
::-webkit-scrollbar-track {
    -webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.3); 
    border-radius: 10px;
}
::-webkit-scrollbar-thumb {
    border-radius: 10px;
    -webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.5); 
}
 
    
    
        mramsath
        
- 657
- 6
- 12

 
    