W3cubDocs

/CSS

scrollbar-width

This is an experimental technology
Check the Browser compatibility table carefully before using this in production.

The scrollbar-width property allows the author to set the maximum thickness of an element’s scrollbars when they are shown.

Initial value auto
Applies to scrolling boxes
Inherited no
Media visual
Computed value as specified
Animation type a length
Canonical order per grammar

Syntax

/* Keyword values */
scrollbar-width: auto;
scrollbar-width: thin;
scrollbar-width: none;

/* <length> values */
scrollbar-width: 1em;   /* A valid length */

/* Global values */
scrollbar-width: inherit;
scrollbar-width: initial;
scrollbar-width: unset;

Values

<scrollbar-width>
Defines the width of the scrollbar either as an explicit non-negative <length> or a keyword. If it's a keyword, it must be one of the following values:
auto The default scrollbar width for the platform.
thin A thin scrollbar width variant on platforms that provide that option, or a thinner scrollbar than the default platform scrollbar width.
none No scrollbar shown, however the element will still be scrollable.

Note: User Agents must apply any scrollbar-width value set on the root element to the viewport.

Formal syntax

auto | thin | none | <length>

Example

CSS

.scroller {
  width: 300px;
  height: 100px;
  overflow-y: scroll;
  scrollbar-width: thin;
}

HTML

<div class="scroller">Veggies es bonus vobis, proinde vos postulo essum magis kohlrabi welsh onion daikon amaranth tatsoi tomatillo melon azuki bean garlic. Gumbo beet greens corn soko endive gumbo gourd. Parsley shallot courgette tatsoi pea sprouts fava bean collard greens dandelion okra wakame tomato. Dandelion cucumber earthnut pea peanut soko zucchini.</div>

Result

Specifications

Specification Status Comment
CSS Scrollbars Level 1
The definition of 'scrollbar-width' in that specification.
Editor's Draft Initial Definition

Browser compatibilityUpdate compatibility data on GitHub

Desktop
Chrome Edge Firefox Internet Explorer Opera Safari
Basic support No No 63
Disabled
63
Disabled
Disabled From version 63: this feature is behind the layout.css.scrollbar-width.enabled preference (needs to be set to true). To change preferences in Firefox, visit about:config.
No No No
Mobile
Android webview Chrome for Android Edge Mobile Firefox for Android Opera for Android iOS Safari Samsung Internet
Basic support No No No 63
Disabled
63
Disabled
Disabled From version 63: this feature is behind the layout.css.scrollbar-width.enabled preference (needs to be set to true). To change preferences in Firefox, visit about:config.
No No No

© 2005–2018 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/CSS/scrollbar-width