CSS appearance Property Demo - Online Reset Native Styles
Reset native styling on form elements with appearance: none. See before and after. Essential for custom forms.
UD5 Toolkit
contain Property Demo
Interactive visualization of layout, paint & size isolation in real-time
Observe how contain:size prevents the container from growing with its children.
contain:size, the container's height is dictated by its children. With it, the height collapses to 0 unless explicitly set.
See how contain:paint clips overflow and contain:layout contains floats.
This text wraps around the float. contain:layout creates a BFC and contains the float entirely.
contain:paint clips it. contain:layout makes the container self-contained for floats.
CSS contain tells the browser what the element's subtree is independent of, enabling powerful optimizations.
contain:layout creates a formatting context boundary. Internal layout changes don't trigger external reflows.
contain:paint acts like a super overflow:hidden — it also creates a stacking context and containing block.
contain:size lets the browser skip subtree size calculations — ideal for virtual scrolling & lazy-loaded widgets.
contain property and why should I use it?
contain property allows you to indicate that an element's subtree is independent from the rest of the page. This gives browsers critical hints to optimize rendering performance. By isolating layout, paint, or size calculations, the browser can skip expensive recalculations when only the contained subtree changes. It's one of the most impactful CSS properties for web performance, especially for complex UIs, widget-heavy pages, and infinite scroll implementations. Values include none, size, layout, paint, style, content (size+layout+paint), and strict (all four).
contain:paint and overflow:hidden?
contain:paint goes significantly further. It creates a new stacking context, establishes a containing block for absolutely positioned descendants, and acts as a paint boundary. This means the browser can paint the element independently — if it hasn't changed, its pixels can be reused from a cached layer. overflow:hidden only clips content without providing these additional isolation guarantees. For performance-critical rendering, contain:paint is the stronger choice.
contain:size work and when does the container collapse?
contain:size tells the browser that the element's size does not depend on its children. For block-level elements without an explicit height, the height collapses to 0 (padding and borders remain). The width typically remains 100% of the parent for block elements in normal flow. This is perfect for virtual scroll containers, lazy-loaded widgets with known dimensions, and carousel items where you want to pre-allocate space. Always set explicit width and height (or use content-visibility:auto which applies size containment automatically) when using contain:size to avoid unexpected collapsing.
contain:layout actually isolate?
contain:layout creates a formatting context boundary (similar to a BFC — Block Formatting Context). This means: (1) Internal layout changes (like a child growing) won't affect elements outside the container — no external reflow. (2) Floats inside the container are contained and won't escape. (3) Margin collapsing between the container's children and external elements is prevented. (4) The container acts as a baseline isolation point. It's ideal for independent UI components like modals, dropdown panels, and sidebar widgets where internal layout stability is desired.
contain and content-visibility?
content-visibility:auto is a powerful CSS property that automatically applies contain:size layout paint (equivalent to contain:content) to elements that are off-screen. This allows the browser to skip rendering work for off-screen content entirely, dramatically improving page load and scroll performance. You can think of contain as the low-level primitive, and content-visibility as the high-level, automated application of containment. Use contain for fine-grained control over always-visible elements, and content-visibility:auto for below-the-fold content sections.
contain value gives the best performance?
contain:strict applies all four containment types (size, layout, paint, style) and offers the maximum isolation. However, it's also the most restrictive. For most practical use cases, contain:content (equivalent to size layout paint) provides an excellent balance of performance and flexibility. It enables all major optimizations while being less restrictive than strict. The key is choosing the least restrictive value that still accurately describes your element's independence — over-containing can break layouts just as under-containing misses optimization opportunities.
contain safe to use on any element?
contain:size will collapse an element's height to 0 if no explicit height is set — this can break layouts unexpectedly. contain:paint creates a new stacking context which may affect z-index behavior. contain:layout affects how floats and margins interact. Always test thoroughly after applying containment. Start with contain:layout or contain:paint individually before combining them, and use browser DevTools to verify the element still renders as expected across all viewport sizes.
contain badge next to elements that have containment applied. In the Rendering tab (available via the three-dot menu → More tools → Rendering), you can enable "Layer borders" to visualize paint-contained layers. The Performance panel also shows reduced layout and paint work for contained elements. Firefox's DevTools similarly highlights containment in the inspector. When things look wrong, temporarily set contain:none to confirm whether containment is the culprit.
Reset native styling on form elements with appearance: none. See before and after. Essential for custom forms.
Compare standard keyboard layouts side-by-side. Click keys to see characters. Useful for learning alternative layouts.
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.
Limit browser gestures on an element: pan‑x, pinch‑zoom, manipulation. Draw on a canvas to test. Mobile dev helper.
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.
Enter a URL and get a one‑page report of titles, description, headings, image alts, and broken links. All from browser.
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.
Press any key and see it light up on a standard QWERTY layout. Check functionality or demonstrate shortcuts.
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.
Experiment with CSS Grid properties visually. Add rows, columns, and areas. See the grid in action and copy the code.
Fetch a website's CSS and extract :root custom properties (‑‑color) to reveal its design token palette. For learning and inspiration.
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.