Skip to content
AITroveRead. Build. Understand.
Make this comfortable

CSS scrollbar-width: keep scrolling discoverable

Last updated: 7 Oct 20265 min read
tutorial
BeginnerBy AITrove Editorial

Scrollbar-width requests an automatic, thin, or hidden scrollbar on a scrolling box. The browser retains control over the actual appearance, and a hidden scrollbar does not remove the box's scrolling behavior.

When to use it

A narrow audit side panel has many records. A thin scrollbar can save a little inline space, but the control must remain visible enough to suggest more content, especially for mouse users who do not know the panel scrolls. The sample keeps overflow auto and applies thin only to that panel. Test classic and overlay scrollbar systems, touch, keyboard page scrolling, and forced colors. Do not set scrollbar-width none merely for a clean screenshot; it can make a second scroll region difficult to discover. If the panel needs more space, first inspect whether a better layout or wider container would solve the problem without altering a system affordance.

css
.audit-side-panel { max-block-size: 32rem; overflow-y: auto; scrollbar-width: thin; }

Cost and verification

The style is inexpensive, but smaller targets can be harder to use. Browser and operating-system settings may override appearance, so never rely on an exact pixel width in a layout calculation. A thin scrollbar does not provide a focus cue for items inside the panel. Keep the region keyboard reachable and make clipped content discoverable with visible structure or an explicit label. Validate at zoom and with long localized row names. If user testing finds the thin affordance difficult, return to auto rather than forcing a custom scrollbar design.

Common Mistakes

  • Do not hide a scrollbar merely to improve a screenshot.
  • Do not assume a fixed physical width across browsers.
  • Do not trade away a usable pointer target to gain a few pixels.

Connected lessons

css
reference
web
Storage details