Skip to content

Instantly share code, notes, and snippets.

@liyanchang
Forked from devinrhode2/clean-scrollbar.css
Last active December 27, 2015 22:49
Show Gist options
  • Save liyanchang/7401280 to your computer and use it in GitHub Desktop.
Save liyanchang/7401280 to your computer and use it in GitHub Desktop.
/**
* Like, basically PERFECT scrollbars
*/
/*
It's pure CSS.
Since a quick google search will confirm people going crazy about Mac OS Lion scrollbars...
this has no fade-out effect.
In Mac OS Lion, the lowest common denominator is always showing scrollbars by a setting.
So, this fits that lowest common denominator.
Facebook, lifehacker, and Google have all basically taken this approach. Of course Google uses incredibly ugly square scrollbars, but so be it.
Also, in regards to the fade in/out effect, this may just be one reason why soo many people outraged (and still hide) the ticker.
Ending note: I recommend this for non-lion users. As a lion user, I prefer my fading out scrollbars. If you sniff a UA of mac os lion, don't add this css.
*/
/* Turn on custom scrollbar */
::-webkit-scrollbar {
width: 9px;
background-color: rgba(0,0,0,0);
-webkit-border-radius: 100px;
}
/* hover effect for both scrollbar area, and scrollbar 'thumb' */
::-webkit-scrollbar:hover {
background-color: rgba(0, 0, 0, 0.09);
}
/* The scrollbar 'thumb' ...that marque oval shape in a scrollbar */
::-webkit-scrollbar-thumb:vertical {
background: rgba(0,0,0,0.4);
-webkit-border-radius: 100px;
background-clip: padding-box;
border: 2px solid rgba(0, 0, 0, 0);
min-height: 10px; /*Prevent it from getting too small */
}
::-webkit-scrollbar-thumb:vertical:active {
background: rgba(0,0,0,0.61); /* Some darker color when you click it */
-webkit-border-radius: 100px;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment