{"id":285700,"date":"2019-04-02T10:17:35","date_gmt":"2019-04-02T17:17:35","guid":{"rendered":"http:\/\/css-tricks.com\/?page_id=285700"},"modified":"2021-02-07T05:45:31","modified_gmt":"2021-02-07T13:45:31","slug":"scrollbar-color","status":"publish","type":"page","link":"https:\/\/css-tricks.com\/almanac\/properties\/s\/scrollbar-color\/","title":{"rendered":"scrollbar-color"},"content":{"rendered":"\n

The scrollbar-color<\/code> property controls the two colors of a scrollbar: the thumb color<\/strong> and the track color<\/strong>. scrollbar-color<\/code> is part of the CSS Working Group’s Scrollbars Module Level 1 draft<\/a>, which is still a work in progress as of this writing.<\/p>\n\n\n\n\n\n\n\n

Prior to scrollbar-color<\/code>, developers had no standard way to change the default appearance of a browser’s scrollbars without resorting to hiding the scrollbar via overflow: hidden<\/code> and rendering JavaScript-based scrollbars or using browser-prefixed scrollbar attributes<\/a>. With scrollbar-color<\/code>, on the other hand, we can style a scrollbar to match a design without resorting to redoing browser functionality or using vendor prefixes.<\/p>\n\n\n\n

.scrollable-element {\n  scrollbar-color: red yellow;\n}<\/code><\/pre>\n\n\n\n
\"scrollbar
Go wild with custom colors<\/figcaption><\/figure>\n\n\n\n

scrollbar-color<\/code> will also accept values of dark<\/code> and light<\/code> to match a user’s preferences if they’re using something like dark mode on Mac OSX<\/a>.<\/p>\n\n\n\n

.scrollable-element {\n  scrollbar-color: dark;\n}<\/code><\/pre>\n\n\n\n

As of March 2019, support for dark<\/code> and light<\/code> values is not available in any browser. <\/code> is supported in Firefox. See the browser support section<\/a> below for details.<\/p>\n\n\n

Syntax<\/h3>\n\n\n
scrollbar-color: auto | dark | light | <color>;<\/code><\/pre>\n\n\n

Values<\/h3>\n\n\n

scrollbar-color<\/code> accepts the following values:<\/p>\n\n\n\n

  • auto<\/code> is the default value and will render the standard scrollbar colors for the user agent.<\/li>
  • dark<\/code> will tell the user agent to use darker scrollbars to match the current color scheme.<\/li>
  • light<\/code> will tell the user agent to use lighter scrollbars to match the current color scheme.<\/li>
  • <color><\/code> specifies two colors to be used for the scrollbar. The first color is for the “thumb” or the moveable part of the scrollbar which appears on top. The second color is for the “track” or the fixed portion of the scrollbar.<\/li><\/ul>\n\n\n\n
    \"\"<\/figure>\n\n\n

    Example<\/h3>\n\n\n

    This combines the new spec syntax and the WebKit prefixed stuff.<\/p>\n\n\n\n