I am trying to change the background color of a vertical scrollbar on a div, so it should not be white in the dark mode in my react app.
None of the webkit-based styling solutions I could find worked in Opera. Neither could I find a way with react-custom-scrollbars-2
package. I would be fine with any solution, be it CSS or JavaScript-based.
Here is a sandbox to play with.
2
Answers
It can be done using
webkit
styling itself.Styling scrollbars always seems a not-so-simple task. Personally, I always prefer
-webkit-scrollbar
and-webkit-scrollbar-thumb
for implementing this.Here is the CSS for the same: