CSS Subgrid Layout Builder - Online Align Nested Grids
Design a layout where nested grids share track sizes with their parent via subgrid. Copy the complete CSS.
UD5 Toolkit
Instantly compare scrollbar-gutter values and visualize layout shift prevention
Welcome! This panel demonstrates scrollbar-gutter in action.
When content grows and a scrollbar appears, the gutter behavior determines whether your layout shifts.
Item AlphaItem BetaItem Gamma
📏 Current content is short — no scrollbar needed.
Welcome! This panel demonstrates scrollbar-gutter in action.
When content grows and a scrollbar appears, the gutter behavior determines whether your layout shifts.
Item AlphaItem BetaItem Gamma
📏 Current content is short — no scrollbar needed.
scrollbar-gutter in CSS?scrollbar-gutter is a CSS property that controls the space (gutter) reserved for the scrollbar. It was introduced in the CSS Overflow Module Level 3 specification. The property allows developers to stabilize the layout by reserving space for the scrollbar even when it's not visible, preventing unwanted layout shifts when the scrollbar appears or disappears. Supported values include auto (default), stable, and stable both-edges.
scrollbar-gutter: stable prevent layout shift?scrollbar-gutter: stable, the browser always reserves the scrollbar's track space, regardless of whether a scrollbar is actually visible. Without it (using auto), the scrollbar appears and disappears dynamically, changing the available content width by approximately 15–17px on Windows. This sudden width change causes text reflow and element repositioning — a major contributor to Cumulative Layout Shift (CLS), which is a Core Web Vital metric. By reserving the space consistently, stable ensures the layout never shifts.
auto and stable?auto (default): The browser decides when to show the gutter. If no scrollbar is needed, no space is reserved. When a scrollbar appears, it takes up space and shrinks the content area — causing layout shift.stable: The gutter space is always reserved, even if the content is short and no scrollbar is needed. The content width remains constant regardless of scrollbar visibility, eliminating layout shift entirely.stable both-edges do?scrollbar-gutter: stable both-edges reserves gutter space on both the left and right edges of the element. This is particularly useful for symmetrical layouts, bidirectional (LTR/RTL) text support, or designs where visual balance is critical. In a left-to-right context, the left gutter is typically unused, but it ensures the layout remains perfectly centered regardless of scrollbar presence on either side.
scrollbar-gutter has no visible effect in the default macOS configuration. To see the effect, go to System Settings → Appearance → Show scroll bars and select "Always". Windows and most Linux distributions show classic scrollbars that occupy space, making the effect immediately visible.
scrollbar-gutter: stable especially valuable — you don't need to guess or hardcode scrollbar widths.
scrollbar-gutter relate to CLS (Cumulative Layout Shift)?scrollbar-gutter: stable on the <html> or <body> element prevents this, helping achieve a CLS score of 0.
scrollbar-gutter with overflow: hidden?scrollbar-gutter: stable works even with overflow: hidden. The gutter space is reserved regardless of the overflow setting, ensuring that if you dynamically change overflow (e.g., opening a modal that locks body scroll), the layout doesn't shift. This is a common pattern: html { scrollbar-gutter: stable; } combined with body.overflow-hidden when modals are open.
scrollbar-gutter?scrollbar-gutter is supported in all modern browsers:
both-edges may have limited support)auto behavior).
scrollbar-gutter globally to prevent layout shifts?html {
scrollbar-gutter: stable;
}
This ensures the gutter is reserved across all pages. Some developers also apply it to specific scrollable containers (sidebars, modals, etc.) where internal layout stability is critical. Note: if your design uses a fixed header with overflow-y: auto on the body, apply it to the scrolling container instead.
scrollbar-gutter and the old overflow: overlay?overflow: overlay (deprecated, removed from the spec) made scrollbars appear as overlays without taking layout space — the opposite goal of scrollbar-gutter: stable. While overlay prevented layout shifts by never reserving space (always overlaying), it caused content to be hidden behind scrollbars. scrollbar-gutter: stable takes the better approach: always reserving space so content is never obscured and layout never shifts. overflow: overlay should not be used in modern projects.
function getScrollbarWidth() {
const el = document.createElement('div');
el.style.cssText = 'overflow:scroll;visibility:hidden;position:absolute;width:100px;';
document.body.appendChild(el);
const w = el.offsetWidth - el.clientWidth;
el.remove();
return w; // Typically 0 or 15-17
}
This tool automatically runs this detection on page load and displays the result.
Design a layout where nested grids share track sizes with their parent via subgrid. Copy the complete CSS.
Create a pure CSS scroll progress indicator using animation‑timeline: scroll(). No JavaScript. Copy the complete code.
Paste your CSS and see warnings for properties that have limited browser support. Links to CanIUse. Modernize safely.
Query the permission state of camera, microphone, geolocation, and more. See the response and learn the API.
Limit browser gestures on an element: pan‑x, pinch‑zoom, manipulation. Draw on a canvas to test. Mobile dev helper.
Acquire and release locks across tabs. Prevent race conditions in IndexedDB or localStorage. Visual queue and lock state.
Test the Fullscreen API: request fullscreen on a colored div, detect changes, and copy the JavaScript boilerplate.
Create complex linear gradients with any number of color stops, exact angles, and length units. Live preview and CSS code.
Style underlines, overlines, and strike-throughs with colors, wavy styles, and thickness. Modern CSS text‑decoration.
Design a button or card that glows on hover. Adjust shadow color, spread, and transition. Copy the CSS. Rich UI.
Create a realistic letterpress (debossed) text effect using CSS text‑shadow and background. Adjust depth and light direction. Copy code.
Generate a subtle noise/grain texture as a CSS background pattern. Adjust opacity and size. For that film look.
Create a customizable checkerboard or grid background using pure CSS gradients. Adjust cell size and colors. Copy the code.
Upload two images and apply CSS blend modes (multiply, screen, overlay, etc.). See the result and copy the filter CSS. Pure frontend.
Add print styles like removing backgrounds, adding page breaks, setting margins. See print preview instantly.
Create a pure CSS countdown timer with a flipping number effect. Adjust duration and style. No JavaScript needed for display.
Create a glowing or rotating border animation around an element. Copy the CSS keyframes. Pure CSS magic.
Create a custom HTML/CSS progress bar with percentage, colors, and animation. Copy the code. Modern UI element.
Design a realistic neon sign text with multiple layers of glow. Copy the CSS and HTML. Perfect for headers.
A replica of the famous Flexbox Froggy game: solve alignment puzzles by writing CSS. Progress saved locally. Fun frontend learning.
Fetch a website's CSS and extract :root custom properties (‑‑color) to reveal its design token palette. For learning and inspiration.
Find safe mixing ratios for the classic elephant toothpaste demonstration. Volume adjustments for different container sizes.
Recreate the target CSS linear gradient by adjusting stops and colors. A unique game for front‑end developers to master gradients.
Browse and search all Font Awesome 6 icons with preview, class name, and unicode. Copy the HTML snippet. Perfect for web developers.
Create text with a gradient fill using CSS background-clip. Configure colors and direction. Copy the code. Works in modern browsers.
A complete, searchable list of all 140+ named HTML/CSS colors with their hex codes and color previews. Click to copy code. Essential web reference.
Visually experiment with Flexbox container and item properties. See the layout update in real time and copy the CSS. Learn by doing, fully interactive.
Minify JavaScript and CSS code to reduce file size for production. Remove whitespace and comments instantly. Run locally, your code stays private.
Easily create asymmetric border radius values and preview the result. Copy the generated CSS instantly. All interactively and browser-based.
Beautify and format your CSS stylesheets instantly. Organize, minify, or prettify CSS code for better readability. Processed securely on client-side.