scrollbar-width
The scrollbar-width property allows the author to set the desired thickness of an element's scrollbars when they are shown.
The purpose of the scrollbar-width is to optimize the space occupied by the scrollbar on a page or element; the purpose is not related to scrollbar aesthetics. The scrollbar-width predefined keyword values indicate to the user agent whether a normal or smaller scrollbar should be rendered. Avoid using none, as hiding a scrollbar negatively impacts accessibility.
Note: For elements that are scrollable only via programmatic means and not by direct user interaction, use the overflow property with a value of hidden rather than scrollbar-width: none.
Browser support
| Feature | Desktop | Mobile | ||||
|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Safari | Chrome Android | Safari iOS | |
| 121 | 121 | 64 | 18.2 | 121 | 18.2 | |
auto | 121 | 121 | 64 | 18.2 | 121 | 18.2 |
none | 121 | 121 | 64 | 18.2 | 121 | 18.2 |
thin | 121 | 121 | 64 | 18.2 | 121 | 18.2 |
Syntax
.sidebar {
overflow-y: auto;
scrollbar-width: thin;
}
/* Hide the scrollbar (scrolling is still possible) */
.clean-scroll {
overflow-y: auto;
scrollbar-width: none;
} Live demo
Use cases
-
Browser-native behavior
Use scrollbar-width to rely on the platform for behavior that would otherwise require extra code or CSS complexity.
-
Progressive enhancement
Enhance the experience where support exists while keeping a solid baseline elsewhere.
Cautions
- Check browser support and actual product need before adding a new platform feature widely.
- Keep feature usage understandable so future contributors know why it was chosen.
Accessibility
- New platform features should still preserve readable defaults and robust interaction patterns.
- Verify that enhancement paths do not leave unsupported environments with a broken experience.