freecoding.school100% FREE · NO SIGNUP
Neon DistrictISSUE #35 of 50

scrollbar styling · ::-webkit-scrollbar

PrismaVSJank the Janitor
Prisma saysScrollbars can be styled with scrollbar-color/width (standard) or ::-webkit-scrollbar (WebKit).

The standard scrollbar-width: thin and scrollbar-color: thumb track give basic control everywhere. For deeper styling in Chrome/Safari, the ::-webkit-scrollbar family lets you fully restyle the bar. Keep scrollbars visible enough that users can find them.

Power-ups you unlock

Jank the Janitor attacks — common mistakes

Boss battleStyle a scroll container with a thin, brand-colored scrollbar in both syntaxes.

Example code

<!doctype html><html><head><meta charset="utf-8">
<style>.s{height:120px;overflow:auto;scrollbar-width:thin;scrollbar-color:#b388ff #140a28;color:#e6e0ff;padding:10px}.s::-webkit-scrollbar{width:8px}.s::-webkit-scrollbar-thumb{background:#b388ff;border-radius:4px}</style></head><body style="background:#06040d;padding:20px"><div class="s"><p>line</p><p>line</p><p>line</p><p>line</p><p>line</p><p>line</p><p>line</p></div></body></html>
▶ Open the interactive comic issue
‹ Scroll-Behavior · Smooth ScrollingWill-Change · The Perf Hint ›