Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Custom CSS Scrollbar for Firefox

I want to customize a scrollbar with CSS.

I use this WebKit CSS code, which works well for Safari and Chrome:

::-webkit-scrollbar {   width: 15px;   height: 15px; }  ::-webkit-scrollbar-track-piece {   background-color: #c2d2e4; }  ::-webkit-scrollbar-thumb:vertical {   height: 30px;   background-color: #0a4c95; } 

How can I do the same thing in Firefox?

I know I can easily do it using jQuery, but I would prefer to do it with pure CSS if it's doable.

like image 475
Dimitri Vorontzov Avatar asked May 29 '11 01:05

Dimitri Vorontzov


People also ask

Can you style scrollbar in Firefox?

style option. To customize Firefox's scrollbar more, check out Custom Scrollbars. Custom Scrollbars is a Firefox and Google Chrome extension with which you can change the scrollbar's color scheme, width, roundness, and buttons.

Does Webkit scrollbar work on Firefox?

Note: ::-webkit-scrollbar is only available in Blink- and WebKit-based browsers (e.g., Chrome, Edge, Opera, Safari, all browsers on iOS, and others).

How do I show the scrollbar in Firefox?

"On Windows, Firefox follows the system preference (System Preferences > Accessibility > Visual Effects > Always show scrollbars)."

Can you style scrollbar CSS?

Currently, styling scrollbars for Chrome, Edge, and Safari is available with the vendor prefix pseudo-element -webkit-scrollbar . Here is a screenshot of the scrollbar that is produced with these CSS rules: This code works in the latest releases of Chrome, Edge, and Safari.


1 Answers

As of late 2018, there is now limited customization available in Firefox!

See these answers:

  • https://stackoverflow.com/a/54101063/405015
  • https://stackoverflow.com/a/53739309/405015

And this for background info: https://bugzilla.mozilla.org/show_bug.cgi?id=1460109


There's no Firefox equivalent to ::-webkit-scrollbar and friends.

You'll have to stick with JavaScript.

Plenty of people would like this feature, see: https://bugzilla.mozilla.org/show_bug.cgi?id=77790


As far as JavaScript replacements go, you can try:

  • https://github.com/mdbootstrap/perfect-scrollbar
  • https://github.com/Grsmto/simplebar
  • https://github.com/vitch/jScrollPane
like image 117
thirtydot Avatar answered Sep 23 '22 05:09

thirtydot