CSS Academy · Lesson

Scrollbar Styling with ::-webkit-scrollbar

Customize scrollbar appearance using webkit pseudo-elements and the scrollbar-color property.

Lesson 4 of 413 steps

Scrollbar Styling with ::-webkit-scrollbar is a free CSS Academy lesson on CoddyKit. This is lesson 4 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the CSS Academy learning path, and your progress syncs across the web and the CoddyKit app. The CSS Academy course includes 4 lessons in total.

Scrollbar Styling Overview

Browsers render default scrollbars that differ across operating systems. CSS allows customizing scrollbar appearance using non-standard webkit pseudo-elements and the modern standard properties.

::-webkit-scrollbar

The root pseudo-element for the entire scrollbar. Set width (vertical) and height (horizontal):

  <div class="scroll-box">Line 1<br>Line 2<br>Line 3<br>Line 4<br>Line 5<br>Line 6</div>

::-webkit-scrollbar-track

The track is the background channel the thumb slides along:

  <div class="scroll-box">Line 1<br>Line 2<br>Line 3<br>Line 4<br>Line 5<br>Line 6</div>

::-webkit-scrollbar-thumb

The thumb is the draggable scroll indicator:

  <div class="scroll-box">Line 1<br>Line 2<br>Line 3<br>Line 4<br>Line 5<br>Line 6</div>

Custom Scrollbar Complete

A complete custom scrollbar implementation:

  <div class="scroll-box">Line 1<br>Line 2<br>Line 3<br>Line 4<br>Line 5<br>Line 6</div>

Modern Standard: scrollbar-color

scrollbar-color is the standardized property supported by Firefox. It sets thumb and track colors in one declaration:

  <div class="scroll-box">Line 1<br>Line 2<br>Line 3<br>Line 4<br>Line 5<br>Line 6</div>

Modern Standard: scrollbar-width

scrollbar-width controls scrollbar size with keyword values:

  <div class="scroll-box">Line 1<br>Line 2<br>Line 3<br>Line 4<br>Line 5<br>Line 6</div>

Cross-Browser Scrollbar Styling

For full cross-browser coverage, use both approaches:

  <div class="scroll-box">Line 1<br>Line 2<br>Line 3<br>Line 4<br>Line 5<br>Line 6</div>

Hiding Scrollbars While Keeping Scroll

Make an element scrollable but hide the scrollbar visually:

  <div class="hide-scrollbar">Line 1<br>Line 2<br>Line 3<br>Line 4<br>Line 5<br>Line 6</div>

Dark Mode Scrollbars

Use the CSS color-scheme property to get OS-native dark scrollbars without custom styling:

  <p>Uses OS-native scrollbar theme via <code>color-scheme</code>.</p>

Accessibility Reminder

Do not make scrollbars too small or invisible in a way that makes scrolling hard to discover. Hidden scrollbars are acceptable for touch-first designs but can be confusing on desktop.

Quick Check

Which standardized CSS property sets scrollbar colors and is supported in Firefox?

Recap

Customize scrollbars with ::-webkit-scrollbar pseudo-elements (WebKit) and the standard scrollbar-color/scrollbar-width properties (Firefox/modern browsers). Use both for full cross-browser support. Use scrollbar-width: none + the webkit equivalent to hide scrollbars while preserving scroll functionality.

Free to start

Learn CSS with an AI tutor — free

Write and run real code in your browser, get instant help from a 24/7 AI tutor, and pick up where you left off on the web or in the app.

Courses
40
Lessons
159

Frequently Asked Questions

Is the “Scrollbar Styling with ::-webkit-scrollbar” lesson free?

Yes — the full text of “Scrollbar Styling with ::-webkit-scrollbar” is free to read here on the web. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the CSS Academy course, upgrade to CoddyKit PRO. The CSS Academy course includes 4 lessons in total.

What will I learn in “Scrollbar Styling with ::-webkit-scrollbar”?

Customize scrollbar appearance using webkit pseudo-elements and the scrollbar-color property. You practise CSS Academy with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.

Do I need any experience to start CSS Academy?

No prior experience is required. CSS Academy on CoddyKit is structured for beginners through advanced learners, so you can start here or from the beginning and move at your own pace. This is lesson 4 of 4.

How long does the “Scrollbar Styling with ::-webkit-scrollbar” lesson take?

Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.

Can I write and run code in this CSS Academy lesson?

Yes. Every CSS Academy lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.

All lessons in this course

  1. overflow: hidden scroll auto clip
  2. scroll-behavior: smooth
  3. scroll-snap-type and scroll-snap-align
  4. Scrollbar Styling with ::-webkit-scrollbar
← Back to CSS Academy