Scrollbars are one of the most overlooked UI elements in web development. Users interact with them constantly, yet most websites still rely on default browser scrollbars. In modern web apps, dashboards, and tools, custom scrollbars help improve usability and visual consistency.
In this article, we’ll understand what scrollbars are, how browsers handle them, and how to customize scrollbars using CSS in a clean, production-ready way.

What Is a Scrollbar?
A scrollbar appears when content overflows its container and allows users to scroll through hidden content vertically or horizontally.
Scrollbars are triggered when:
- Content height exceeds container height
- Content width exceeds container width
.wrapper {
height: 250px;
overflow-y: auto;
}
According to Mozilla’s documentation, the overflow property defines how extra content is handled inside an element (MDN Web Docs).
Why Scrollbars Matter in Modern Web Design
In real-world projects like:
- Admin dashboards
- Chat applications
- Code editors
- Developer tools
Default scrollbars often look inconsistent with modern UI systems. Subtle customization improves UX without affecting performance, especially in web applications where scrolling is frequent.
Well-designed scrollbars are also recommended as part of overall UI consistency in modern CSS layouts (CSS-Tricks).
CSS Overflow Properties (Scrollbar Control)
Scrollbar visibility is controlled using the overflow property.
overflow: auto;
overflow: scroll;
overflow: hidden;
overflow-x: auto;
overflow-y: scroll;
Most developers prefer overflow: auto because it shows scrollbars only when required.
Styling Scrollbars Using CSS (Chrome, Edge, Safari)
WebKit-based browsers support custom scrollbar styling using pseudo-elements.
Basic Scrollbar Width
::-webkit-scrollbar {
width: 8px;
}
Scrollbar Track
::-webkit-scrollbar-track {
background: #f3f4f6;
}
Scrollbar Thumb
::-webkit-scrollbar-thumb {
background: #6366f1;
border-radius: 8px;
}
Hover Effect
::-webkit-scrollbar-thumb:hover {
background: #4f46e5;
}
Google Chrome documents this behavior under non-standard CSS extensions, which are widely supported in modern browsers (Chrome Developers).
Firefox Scrollbar Styling (Standard Way)
Firefox follows a standardized approach for scrollbar customization.
* {
scrollbar-width: thin;
scrollbar-color: #6366f1 #f3f4f6;
}
Supported values:
autothinnone
This method is officially recommended for Firefox compatibility (MDN Web Docs).
Hide Scrollbar Without Disabling Scroll
This technique is commonly used in mobile-first layouts or minimal UI designs.
.scroll-hidden {
-ms-overflow-style: none;
scrollbar-width: none;
}
.scroll-hidden::-webkit-scrollbar {
display: none;
}
Users can still scroll using mouse, touch, or keyboard input.
Styling Scrollbars for a Specific Container
Instead of styling scrollbars globally, target only the required elements.
.content-box {
max-height: 300px;
overflow-y: auto;
}
.content-box::-webkit-scrollbar {
width: 6px;
}
.content-box::-webkit-scrollbar-thumb {
background: #0ea5e9;
border-radius: 6px;
}
This approach works well for:
- Comment sections
- Tool outputs
- Sidebar widgets
Smooth Scrolling for Better UX
Smooth scrolling improves navigation, especially for anchor links.
html {
scroll-behavior: smooth;
}
This small enhancement noticeably improves reading experience on long pages.
Accessibility Considerations
When customizing scrollbars, accessibility should remain a priority:
✔ Keep sufficient color contrast
✔ Avoid extremely thin scrollbars
✔ Don’t disable keyboard scrolling
✔ Test across devices
Over-styled scrollbars can harm usability more than help it.
Common Mistakes Developers Make
- Removing scrollbars entirely without fallback
- Styling scrollbars globally for all elements
- Ignoring Firefox compatibility
- Making scrollbars too thin to use comfortably
Final Thoughts
Scrollbars may seem like a minor detail, but they play a major role in user experience. With a few lines of CSS, you can create clean, modern, and user-friendly scroll behavior without sacrificing accessibility or performance.
For modern websites and web apps, understanding scrollbar customization is no longer optional—it’s a practical front-end skill.
Responsive Web App Tips Using Tailwind CSS
Learn Web Development in 2026: The Ultimate Beginner-to-Pro Guide

