CSS Reference ยท Scrolling, Interaction and UI
The scrollbar-width property
Reference for the CSS scrollbar-width property: use a thin scrollbar or hide it entirely without losing scrolling, with a live example and accessibility notes.
The scrollbar-width property lets you ask for a thinner scrollbar, or none at all. It takes keywords rather than pixel sizes, so each platform keeps control of the exact dimensions.
Setting none hides the scrollbar but does not stop the box from scrolling: wheel, keyboard and touch scrolling still work. That is useful for carousels, but it removes a visual hint that more content exists.
.list { overflow-y: auto; scrollbar-width: thin; }
Try it
The third box has no visible scrollbar, yet the wheel still scrolls it.
Syntax
scrollbar-width: auto | thin | none;
- Initial value:
auto - Applies to: scroll containers
- Inherited: no
- Animatable: no
- Computed value: as specified
Values
| Value | Description |
|---|---|
auto |
The platform default width. |
thin |
A thinner scrollbar, if the platform has one; otherwise the default. |
none |
No scrollbar is shown. The box remains scrollable. |
Usage notes
- If you hide the scrollbar, provide another cue (a fade at the edge, arrows, page dots) so users know content continues.
- Do not use
noneon the main page or long text areas; people rely on the scrollbar to see position and to drag quickly. - A hidden scrollbar also stops reserving space, so layouts may shift.
scrollbar-guttercontrols that. - Thin scrollbars are harder to grab for people with motor impairments. Use
thinfor secondary panels, not for primary scrolling. - Combine with
scrollbar-colorfor a themed but still native scrollbar. - The older way to hide a scrollbar,
::-webkit-scrollbar { display: none }, only worked in some browsers.
Browser support
Supported in the current versions of the major browsers; older versions ignore it and show normal scrollbars, so check a compatibility table if that matters.
Related
scrollbar-colorโ thumb and track colorsscrollbar-gutterโ reserve scrollbar spaceoverflowโ decides when a scrollbar appears- Lesson: Overflow