Custom Scrollbar CSS Generator - Online Firefox & Webkit
Design a fully styled scrollbar with colors, width, radius, and hover effects. Supports both ::-webkit‑scrollbar and Firefox scrollbar‑width.
UD5 Toolkit
Instantly compare smooth vs auto scrolling side‑by‑side. Click any section button below to see the difference.
/* Enable smooth scrolling for the entire page */
html {
scroll-behavior: smooth;
/* Optional: offset for fixed headers */
scroll-padding-top: 80px;
}
/* Respect user motion preferences */
@media (prefers-reduced-motion: reduce) {
html {
scroll-behavior: auto;
}
}
/* Smooth scrolling inside a specific element */
.custom-scroll-box {
overflow-y: auto;
scroll-behavior: smooth;
scroll-padding-top: 16px;
}
/* Target elements can use scroll-margin */
.custom-scroll-box .section {
scroll-margin-top: 16px;
}
Everything you need to know about CSS scroll-behavior
scroll-behavior is a CSS property that controls how scrolling behaves when triggered by navigation (anchor links, scrollTo(), etc.). It accepts two values: smooth (animated gliding) and auto (instant jump). It's part of the CSSOM View Module and is widely supported across modern browsers.
Add html { scroll-behavior: smooth; } to your global stylesheet. This single line enables smooth scrolling for all anchor link navigation across your site. For fixed headers, also set scroll-padding-top to the header height so targets aren't hidden behind it.
Chrome 61+ (Sep 2017), Firefox 36+ (Feb 2015), Edge 79+ (Jan 2020), Safari 15.4+ (Mar 2022), and Opera 48+. Internet Explorer does not support it. Global coverage is approximately 96%+ as of 2025. For unsupported browsers, it gracefully falls back to auto behavior.
scroll-behavior: smooth is a declarative CSS solution — it applies to all scroll actions within the element automatically. element.scrollIntoView({ behavior: 'smooth' }) is an imperative JavaScript method for one-off scrolls. CSS is simpler and doesn't require scripting; JS gives you more granular control (e.g., scroll to a specific offset, chain animations). You can use both together.
No. The smooth value uses the browser's built-in easing curve, which cannot be customized via CSS. If you need custom speed or easing functions, use JavaScript libraries like Lenis, GSAP ScrollToPlugin, or implement your own requestAnimationFrame loop. The CSS property is designed for simplicity, not fine-tuned control.
It can. Some users with vestibular disorders may find smooth scrolling disorienting. Always wrap your smooth-scroll CSS in a @media (prefers-reduced-motion: reduce) query that sets scroll-behavior: auto. This respects the user's system-level accessibility preference. Also, smooth scrolling adds a slight delay before the target is reached, which may impact users relying on instant navigation.
scroll-padding is a CSS shorthand that defines an offset inside the scroll container. When smooth-scrolling to a target, the container stops early by the padding amount, preventing the target from touching the edge. It's especially useful with fixed headers: html { scroll-padding-top: 80px; } ensures anchor targets land 80px below the top of the viewport, clear of a sticky nav bar.
scroll-margin is applied to the target elements themselves, while scroll-padding is applied to the scroll container. Use scroll-margin-top on individual sections if you want different offsets per target. Use scroll-padding-top on the container for a uniform offset. Both achieve similar visual results but from different sides of the scroll boundary.
Yes! scroll-behavior works for both vertical and horizontal scrolling. If your container has overflow-x: auto and you navigate horizontally (e.g., via scrollTo({ left: ... })), the smooth or auto behavior applies equally. It's direction-agnostic.
No. scroll-behavior is not an animatable property — it's a discrete property. You cannot transition between smooth and auto. The property determines how the scroll action is performed, not a visual style that can be interpolated. It takes effect immediately when changed.
Design a fully styled scrollbar with colors, width, radius, and hover effects. Supports both ::-webkit‑scrollbar and Firefox scrollbar‑width.
Construct a CSS‑only carousel with scroll‑snap and scroll‑driven animations. Configurable gap, items, and progress indicator. Copy the HTML/CSS.
Design beautiful buttons with gradients, shadows, and hover/active effects. No JavaScript required. Copy the CSS.
Pick two images or colors and apply all 16 CSS mix‑blend‑mode values live. See and copy the right CSS for your design.
Toggle between normal, nowrap, pre, pre‑wrap, and pre‑line to understand how whitespace is handled. Live text example.
Design a modern button with gradients, shadows, and hover effects. Copy the clean CSS code.
Pick a COLRv1 color font and change its palette with font‑palette. Create custom palettes with @font‑palette‑values.
Drag points to create a custom clip‑path shape. See the CSS value update live. For creating non‑rectangular elements.
Choose from a dozen pure CSS loading spinners. Customize color, size, and speed. Copy the HTML & CSS. No JavaScript needed.
Type text and instantly see it rendered with text‑transform: uppercase, lowercase, capitalize, and full‑width. Copy CSS.
Write CSS like `oklch(from red l c h)` to modify colors dynamically. Preview the output and copy the code.
Build a complete font‑stack for your website. Choose a primary font and get the best fallback options for different OS. Copy the CSS.
Add rows and columns, merge cells, and set gaps visually. Get the grid‑template CSS and HTML. Fast layout prototyping.
Build a custom CSS reset by toggling which elements to normalize. Copy the resulting stylesheet. Lean and clean.
Design a custom focus indicator with outline, offset, and box‑shadow. Preview on interactive elements. Copy the CSS.
Pick two colors and mix them in different color spaces with sliders. See the difference between sRGB and OKLCH mixing. Copy the code.
Visually apply CSS transform functions like rotate, scale, skew, and translate. Obtain the exact CSS code for your elements. No coding needed.
Set perspective and rotate children in 3D space. See the effect of perspective‑origin. Copy the CSS. Learn 3D transforms.
Add multiple CSS filters (grayscale, blur, hue‑rotate) to an image. See the combined effect. Copy the CSS filter value.
Write CSS like `oklch(from red l c h)` to modify colors. Preview the output and copy. Modern color manipulation.
Browse a collection of ready-to-use CSS animations (fade, slide, bounce). Click to preview, then copy @keyframes and class to your project. Local tool.
Convert hex, RGB, or HSL into the modern OKLCH color space. See the preview and copy CSS oklch() value. Local.
Minify JavaScript and CSS code to reduce file size for production. Remove whitespace and comments instantly. Run locally, your code stays private.
Style underlines, overlines, and strike-throughs with colors, wavy styles, and thickness. Modern CSS text‑decoration.
Design a custom focus indicator with outline, offset, and box‑shadow. Preview on interactive elements. Copy the CSS.
Set column‑count, gap, and rule, and see a multi‑column text layout. Copy the minimal CSS. For magazine designs.
Create a multi‑column text layout with adjustable column count, gap, and rule. Copy the CSS. Elegant reading experience.
Generate CSS-only triangles by configuring direction, size, and color. Copy the CSS snippet. Useful for creating speech bubbles and navigation arrows.
Compile LESS code to plain CSS in your browser. Check for syntax errors and get clean output. For legacy projects.
Paste or upload an SVG and convert it into a CSS background‑image data URI. Clean and ready to embed.