Container Style Queries Playground - Online @container style()
Test the new style() function inside @container to query custom property values. Revolutionary componentâbased responsive design.
UD5 Toolkit
Interactive @container rule tester â drag to resize & see container queries in action
@container rule, you can create truly reusable, context-aware components that adapt to any layout slot. First define a containment context with container-type: inline-size on the parent, then write @container (min-width: 400px) { ... } to apply styles when the container meets the condition.container-type: inline-size creates a containment context that tracks the element's inline dimension (width in horizontal writing modes). This is the most common setting and sufficient for most use cases. Other values: size tracks both width and height, normal disables containment (default). Using inline-size is preferred for performance since it only monitors one axis.container-name assigns a name to your containment context, letting you target a specific container in nested layouts. Example: container-name: sidebar on the parent, then @container sidebar (min-width: 300px) { ... } targets only that container. Without a name, @container queries the nearest ancestor with a containment context. Named containers prevent ambiguity in complex nested structures.@supports (container-type: inline-size) to provide fallback styles or polyfill with JavaScript.@container rules with different breakpoints â just like media queries. For example, you might have rules for max-width: 350px, min-width: 350px and max-width: 600px, and min-width: 600px to create three distinct layout tiers. The most specific matching rule applies, following standard CSS cascade principles.container-type: inline-size has minimal overhead. However, container-type: size (tracking both axes) requires more computation. Best practices: only apply containment to elements that need it, prefer inline-size over size when possible, and avoid deeply nested container queries (grandparent + parent + child all having containment) unless necessary.cqw (1% of container width), cqh (1% of container height), cqmin, and cqmax. These work like viewport units (vw, vh) but are relative to the container, not the viewport. For example, font-size: 5cqw makes text scale with the container's width â incredibly useful for fluid component typography.Test the new style() function inside @container to query custom property values. Revolutionary componentâbased responsive design.
Write a media query and see if it matches as you resize the iframe. Understand width, height, and resolution queries.
Paste media queries and see a visual indicator of which rules apply at current viewport size.
Write a media query and instantly see if it matches your current viewport. Width, height, orientation, and more.
Combine aspectâratio with minâ/maxâwidth/height and see how the box responds. Understand sizing constraints. Copy the pattern.
Build a CSS media query by selecting feature, operator, and value. Copy the exact syntax for your stylesheet.
Experiment with the CSS color-mix() function. Pick two colors and mix them in different color spaces (srgb, oklch). Copy the CSS.
Paste a media query and instantly check for syntax errors. See if it's correctly formed. Quick developer tool.
Create a responsive box that maintains a specific aspect ratio using the aspectâratio property. Copy the simple CSS.
Upload an image at multiple widths and generate a complete <picture> or <img srcset> snippet. Modern web performance.
Wrap text around an irregular shape and adjust the margin and alpha threshold. Magazines layout on the web.
Compare breakâall, keepâall, and overflowâwrap: anywhere/breakâword. Paste long words and see how they wrap.
Visually name grid areas in a table and generate gridâtemplateâareas CSS. Perfect for complex layouts. Dragâfree.
Place a table caption on top, bottom, or inlineâstart/end. See the live change. Copy the code.
Upload multiple sizes of the same image and generate the complete srcset and sizes attributes. For perfect responsive performance.
Toggle imageârendering: auto, pixelated, crispâedges on a scaled image. Essential for pixel art display.
Paste image URLs and generate a responsive masonry or justified gallery layout with lightbox. Copy the HTML/CSS/JS.
Upload a small pixel art image and get a CSS grid layout that recreates it using divs. Novelty developer tool.
Design a layout where nested grids share track sizes with their parent via subgrid. Copy the complete CSS.
Upload one image at multiple widths and generate the complete img srcset and sizes attributes. Perfect for performance.
A horizontal photo gallery that scrolls with a smooth CSS animation using scrollâtimeline. Pure HTML/CSS. Copy the code.
Drag a virtual ruler across your screen to measure pixel distances. Horizontal and vertical guides. Useful for UI designers checking alignment.
See how your page title and description will look in Google SERP. Check pixel width and character count. Local tool.
Browse the OKLCH color space with sliders for lightness, chroma, and hue. See the CSS oklch() code. Modern and accessible.
Preview how your page title will appear in Google SERPs. See pixel width and character count. Avoid truncation. Free local tool for SEOs.
Add services like Node, Postgres, Redis, and Nginx. Configure ports, volumes, and env vars. Download the dockerâcompose.yml.
Toggle between light and dark mode for a demo page. See how to use the media query. Copy the pattern.
Detect your current screen resolution, viewport dimensions, and device pixel ratio. Useful for responsive design testing. No data collection.
Open a test video in PictureâinâPicture mode. Control entering and leaving PiP. Copy the code snippet for your own app.
See the current viewport width/height, document size, scrollbar width, and pixel ratio. Essential responsive data.