I saw this stackoverflow post CSS div element - how to show horizontal scroll bars only? However when I try the answers the scroll bar is not shown. I can scroll horizontally, but I also want the horizontal scroll bar to be shown. I am trying this on chrome and Mac. Here is my code:
<div style="width:500px; overflow-x:scroll; border:dotted 1px; white-space: nowrap;padding-bottom:10px;">
<img src="img1.jpeg">
<img src="img2.jpeg">
<img src="img3.jpeg">
<img src="img4.jpeg">
<img src="img5.jpeg">
</div>
JsFiddle: https://jsfiddle.net/t30xshro/
As stated in the comments, OSX hides scrollbars by default.
There are a few CSS options which explicitly work for osX/Chrome in order to handle ScrollBar behaviour/appearance:
.frame::-webkit-scrollbar {
-webkit-appearance: none;
}
.frame::-webkit-scrollbar:horizontal {
height: 11px;
}
.frame::-webkit-scrollbar-thumb {
border-radius: 8px;
border: 2px solid white;
background-color: rgba(0, 0, 0, .5);
}
.frame::-webkit-scrollbar-track {
background-color: #fff;
border-radius: 8px;
}
JsFiddle: https://jsfiddle.net/peanut/zvskLcef/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With