Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Always show scrollbar in Bootstrap table-responsive

I am using .table-responsive class to make my Bootstrap tables responsive and it's working fine but the user doesn't have any indicator that the table is horizontally scrollable!

How can I make the horizontal scrollbar always displayed, not only after the user actually starts scrolling.

Edit

The solution mentioned here almost works: Always show scrollbars in iPhone/Android:

::-webkit-scrollbar {
    -webkit-appearance: none;
}

::-webkit-scrollbar:vertical {
    width: 12px;
}

::-webkit-scrollbar:horizontal {
    height: 12px;
}

::-webkit-scrollbar-thumb {
    background-color: rgba(0, 0, 0, .5);
    border-radius: 10px;
    border: 2px solid #ffffff;
}

::-webkit-scrollbar-track {
    border-radius: 10px;  
    background-color: #ffffff; 
}

Its problem is showing the scrollbars everywhere, not just to .table-responsive class. How I can restrict it?

like image 203
Adam Silver Avatar asked Sep 11 '14 00:09

Adam Silver


1 Answers

Sorry for being 5 years late, but you must add .table-responsive before the pseudo-element, like this:

.table-responsive::-webkit-scrollbar {
    -webkit-appearance: none;
}

.table-responsive::-webkit-scrollbar:vertical {
    width: 12px;
}

.table-responsive::-webkit-scrollbar:horizontal {
    height: 12px;
}

.table-responsive::-webkit-scrollbar-thumb {
    background-color: rgba(0, 0, 0, .5);
    border-radius: 10px;
    border: 2px solid #ffffff;
}

.table-responsive::-webkit-scrollbar-track {
    border-radius: 10px;  
    background-color: #ffffff; 
}
like image 80
rafael.js Avatar answered Oct 02 '22 20:10

rafael.js