One day some designers provide you with beautiful mock-ups 🌠 and … custom macOS-like scrollbars which look like:
But maybe on the left, smaller or bigger, with different indents dependent on whether it’s mobile 📱, desktop 🖥️ or TV screen 📺 Asking more?
But the reality is… a customisation of scrollbars remains same since the end of 90s. If my dad was programming, he would make fun of me all day while I found the solution to make everything universal and stable. It’s 2018 and it’s still a PITA.
✅ Webkit and Blink
It means at least it’s working on Chrome, Safari, Opera, Edge Mobile (both iOS and Android) and less known such as Vivaldi and others.
Since Firefox 64 was released, scrollbar customisation is now available.
I remind you, that original bug was reported 18 years ago, only less than 1 year ago implementation of CSS Scrollbars Module Level 1 was considered 😔.
Yet it’s not working for me when you try this chunk of CSS:
scrollbar-color: rebeccapurple green;
Check it in your FF, mine is not working with this.
However, if you try this, it works perfect:
If you are not familiar with it, probably forget about it. It’s IE11. Such a pain everywhere. Maybe not supporting it at all?
However, even it has CSS properties which might help:
And also autohiding scrollbar property!!! Thanks 🙏⚡
Another one is EdgeHTML which is a fork of Trident and used in Edge. It has only enhancement in its backlog with medium priority to add support for scrollbar styling. Never be done 😞
CSS Hacks and tricks
Slowly but surely we achieve what we want.
Scrollbar on the left
Turn scrollbar on with JS
Accepting the fact FF, Edge and IE do not support scrollbar customisation, JS library might be not bad solution for them.
A size of scrollbar JS bundle should be worth it. However it’s not what it’s expected.
lib / minified in KB / minified + gzipped in KB
🕳️ size of black hole
nanoscroller / 94.8 / 32.8 (with jQ)
iscroll / 32.1 / 8.3
perfect-scrollbar / 17.7 / 5.2
jscrollpane / 15.6 / 5.2
simplebar / 10–15 / 4.35
🤘 light enough
nanoscroller / 8.34 / 2.89 (without jQ)
slim-scroll / 4.2 / 1.8
🐥 too good to be ideal
simple-scrollbar / 2.3 / 0.94
Bundlephobia helps evaluating sizes of bundles.
Of course, good options are lightweight vanilla libraries.
Some of choices like simple-scrollbar provide scrollbars unfriendly for mobile devices. It is required to add a lot of functionality and therefore not production-ready.
slim-scroll is created by a stack overflow user and is aimed to improve design on Windows. That’s good as macOS scrollbar looks good everywhere. However, native customisation is only available on WebKit and Blink.
Have a productive week 💪
Probably you want to customise you own scrollbar. First have a look at scrollbar mechanics.