Logo Image
blog

Creating Custom Scrollbars with CSS

HTML5 & CSS3

icon-image

SCSS

icon-image

JavaScript

icon-image

TypeScript

icon-image

React

icon-image

Next.js

icon-image

Tailwind CSS

icon-image

Bootstrap

icon-image

ShadCN UI

icon-image

Styled Components

icon-image

GSAP

icon-image

Framer Motion

icon-image

Vite

icon-image

Shopify themes

icon-image

i18next & RTL

icon-image

Recharts

icon-image

Chart.js

icon-image

SaaS dashboards

icon-image

Figma to UI

icon-image

Dark / light mode

icon-image

4+ years

icon-image

Vistothemes

icon-image

Freelance UI

icon-image

NFT & crypto UI

icon-image

eCommerce UI

icon-image

WordPress CSS

icon-image

Remote-ready

icon-image

Muhammad Shahzaib

icon-image

Pixel-perfect

icon-image

Component architecture

icon-image

Live demos

icon-image

HTML5 & CSS3

icon-image

SCSS

icon-image

JavaScript

icon-image

TypeScript

icon-image

React

icon-image

Next.js

icon-image

Tailwind CSS

icon-image

Bootstrap

icon-image

ShadCN UI

icon-image

Styled Components

icon-image

GSAP

icon-image

Framer Motion

icon-image

Vite

icon-image

Shopify themes

icon-image

i18next & RTL

icon-image

Recharts

icon-image

Chart.js

icon-image

SaaS dashboards

icon-image

Figma to UI

icon-image

Dark / light mode

icon-image

4+ years

icon-image

Vistothemes

icon-image

Freelance UI

icon-image

NFT & crypto UI

icon-image

eCommerce UI

icon-image

WordPress CSS

icon-image

Remote-ready

icon-image

Muhammad Shahzaib

icon-image

Pixel-perfect

icon-image

Component architecture

icon-image

Live demos

icon-image
home

/

blog

2026-09-173 min read
Creating Custom Scrollbars with CSS

Default browser scrollbars rarely match a site's design system. This site's own scrollbar (check the edge of this page) is styled with exactly the approach below — a thin track and thumb that pick up the site's ink/accent colors in both light and dark mode.

WebKit browsers (Chrome, Edge, Safari)

::-webkit-scrollbar, ::-webkit-scrollbar-track, and ::-webkit-scrollbar-thumb give full control over width, color, and radius. These are non-standard pseudo-elements, but they cover the large majority of desktop traffic.

Firefox

Firefox uses the standardized scrollbar-width (auto | thin | none) and scrollbar-color (thumb + track, two color values) properties instead. There's no direct equivalent to the WebKit radius/padding control — Firefox keeps its native shape.

The usability rule

Never drop the scrollbar below ~8-10px or remove enough contrast that it disappears against the track — a scrollbar someone can't see or grab is a real accessibility regression, not a style win.

scrollbar.css
html::-webkit-scrollbar {
  width: 10px;
}

html::-webkit-scrollbar-track {
  background: var(--color-background);
}

html::-webkit-scrollbar-thumb {
  background: #b4bac6;
  border-radius: 20px;
}

/* Firefox */
html {
  scrollbar-width: thin;
  scrollbar-color: #b4bac6 var(--color-background);
}

Keep it subtle. A scrollbar is a functional control first — the styling should confirm the site's design language, not compete for attention with it.

← back to all writing

Muhammad Shahzaib

Frontend Developer

React & Next.js

TypeScript

Tailwind CSS

Muhammad Shahzaib

SaaS dashboards

Shopify themes

GSAP & Framer

Muhammad Shahzaib

ShadCN UI

RTL & i18next

Figma to UI

Muhammad Shahzaib

4+ years

Vistothemes

Freelance UI

Muhammad Shahzaib

Remote work

pixel-perfect

Muhammad Shahzaib

Frontend Developer

React & Next.js

TypeScript

Tailwind CSS

Muhammad Shahzaib

SaaS dashboards

Shopify themes

GSAP & Framer

Muhammad Shahzaib

ShadCN UI

RTL & i18next

UI-only scope

Muhammad Shahzaib

your mockups

production UI

Muhammad Shahzaib

Muhammad Shahzaib

Frontend Developer

React & Next.js

TypeScript

Tailwind CSS

Muhammad Shahzaib

SaaS dashboards

Shopify themes

GSAP & Framer

Muhammad Shahzaib

ShadCN UI

RTL & i18next

Figma to UI

Muhammad Shahzaib

4+ years

Vistothemes

Freelance UI

Muhammad Shahzaib

Remote work

pixel-perfect

Muhammad Shahzaib

Frontend Developer

React & Next.js

TypeScript

Tailwind CSS

Muhammad Shahzaib

SaaS dashboards

Shopify themes

GSAP & Framer

Muhammad Shahzaib

ShadCN UI

RTL & i18next

UI-only scope

Muhammad Shahzaib

your mockups

production UI

Muhammad Shahzaib

Muhammad Shahzaib

Frontend Developer

React & Next.js

TypeScript

Tailwind CSS

Muhammad Shahzaib

SaaS dashboards

Shopify themes

GSAP & Framer

Muhammad Shahzaib

ShadCN UI

RTL & i18next

Figma to UI

Muhammad Shahzaib

4+ years

Vistothemes

Freelance UI

Muhammad Shahzaib

Remote work

pixel-perfect

Muhammad Shahzaib

Frontend Developer

React & Next.js

TypeScript

Tailwind CSS

Muhammad Shahzaib

SaaS dashboards

Shopify themes

GSAP & Framer

Muhammad Shahzaib

ShadCN UI

RTL & i18next

UI-only scope

Muhammad Shahzaib

your mockups

production UI

Muhammad Shahzaib

Muhammad Shahzaib

Frontend Developer

React & Next.js

TypeScript

Tailwind CSS

Muhammad Shahzaib

SaaS dashboards

Shopify themes

GSAP & Framer

Muhammad Shahzaib

ShadCN UI

RTL & i18next

Figma to UI

Muhammad Shahzaib

4+ years

Vistothemes

Freelance UI

Muhammad Shahzaib

Remote work

pixel-perfect

Muhammad Shahzaib

Frontend Developer

React & Next.js

TypeScript

Tailwind CSS

Muhammad Shahzaib

SaaS dashboards

Shopify themes

GSAP & Framer

Muhammad Shahzaib

ShadCN UI

RTL & i18next

UI-only scope

Muhammad Shahzaib

your mockups

production UI

Muhammad Shahzaib

arrow-image

Start a project — tell me what you’re building and your timeline.

logo-image

I’m Muhammad Shahzaib—a frontend developer with 4+ years at Vistothemes and on freelance SaaS projects (Deedible, Next Health, Truckers Finder). I build pixel-perfect UI with React, Next.js, TypeScript, Tailwind, ShadCN, and Shopify—plus HTML/CSS templates, RTL bilingual layouts, and dashboard work with Recharts and Chart.js. UI only; no backend or APIs.

Muhammad Shahzaib Copyright © 2026. All Rights Reserved.