macOS hides scrollbars for trackpad users, which results in my users not knowing they can scroll a result set horizontally. I'm trying to use CSS to target the horizontal scrollbars only, so that I can make them permanently visible.
I'm able to override both scrollbar visual behavior with CSS:
::-webkit-scrollbar{
-webkit-appearance: none;
width: 7px;
}
::-webkit-scrollbar-thumb{
border-radius: 4px;
background-color: rgba(0,0,0,.5);
box-shadow: 0 0 1px rgba(255,255,255,.5);
}
https://jsfiddle.net/ypk62h8v/1/
But when I try to apply the :horizontal pseudo-element, it doesn't work (Mac/Chrome):
HTML:
<div class="frame" style="">
<div style="width:500px;height:500px;">
SCROLLABLE
</div>
</div>
CSS:
.frame {
overflow-y: auto;
overflow-x: auto;
border: 1px solid black;
height: 3em;
width: 10em;
line-height: 1em;
}
::-webkit-scrollbar:horizontal {
-webkit-appearance: none;
width: 7px;
}
::-webkit-scrollbar-thumb:horizontal {
border-radius: 4px;
background-color: rgba(0,0,0,.5);
box-shadow: 0 0 1px rgba(255,255,255,.5);
}
overflow: scroll
instead ofoverflow: auto
should accomplish that for you. Emphasis on should. I can't seem to get it to work on my MacBook with touchpad in any browser despite the docs here: developer.mozilla.org/en-US/docs/Web/CSS/overflow#scroll – Acacia