Scrollbar customisation

Alexey Berezin
4 min readOct 4, 2018


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 2020 and it’s still a PITA.

Native support

✅ Webkit and Blink

::-webkit-scrollbar {}
::-webkit-scrollbar-button {}
::-webkit-scrollbar-track {}
::-webkit-scrollbar-track-piece {}
::-webkit-scrollbar-thumb {}
::-webkit-scrollbar-corner {}
::-webkit-resizer {}

It means at least it’s working on Chrome, Safari, Opera, Edgium (Edge based on WebKit for iOS and Blink for Android, Windows and MacOS) and and less known such as Vivaldi and others.


✅ Gecko

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:

.container {
scrollbar-color: rebeccapurple green;
scrollbar-width: 5px;

Check it in your FF, mine is not working with this.


However, if you try this, it works perfect:

.container {
scrollbar-width: thin;
Mac. On the left — original size. On the right thin. Now you see the difference
Same for Windows.

More information you can find on MDN: scrollbar-width and scrollbar-color.

❌ Trident-related

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:

Only colours 🔴🍏📘 ughhh…

And also autohiding scrollbar property!!! Thanks 🙏⚡

Another one is EdgeHTML which is a fork of Trident and used in old Edge. It had only enhancement in its backlog with medium priority to add support for scrollbar styling. But since Edgium release you can use Webkit / Blink pseudo elements 🎉.

CSS Hacks and tricks

Slowly but surely we achieve what we want.

Scrollbar on the left

transform: with great support

direction: with not bad support

Hiding scrollbar

overflow, margin and padding: horizontal and vertical

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.


Unfortunately some of libraries are plugins for jQuery: jScrollPane, nanoScroller. And this is not what can be a fit.

Bundle size

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.2 / 32.4 (with jQ)
simplebar / 63.5 / 19 (with lodash, resize observer polyfill and core-js)
iscroll / 32.1 / 8.3
perfect-scrollbar / 17.7 / 5.1
jscrollpane / 15.7 / 5.2
🤘 light enough
nanoscroller / 8.31 / 2.89 (without jQ)
slim-scroll / 4.2 / 1.8
🔥 too good to be true
simple-scrollbar / 2.3 / 0.97

Bundlephobia helps evaluating sizes of bundles.

Of course, good options are lightweight vanilla libraries.

Mobile support

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.

My last choice: to try perfect-scrollbar or simplebar.

Have a productive week 💪

Your implementation

Probably you want to customise you own scrollbar. First have a look at scrollbar mechanics.

Alexey Berezin,
Graduate student from St Petersburg State University, Master’s
Front-end Developer from Yandex