scrollâstate Container Query Demo - Online Test stuck/snapped
Experiment with scrollâstate container queries to style elements when they are stuck, snapped, or overflowed. Experimental.
UD5 Toolkit
Track metrics and gain insights with real-time dashboards.
Enterprise-grade protection for your data pipeline.
One-click deployments to production environments.
@container at-rule, you can apply styles conditionally when a container meets certain size conditions (like minimum width). This enables truly component-based responsive designâthe same component adapts whether it's in a narrow sidebar or a wide main content area.
container-type property. The most common value is container-type: inline-size; which allows querying the container's inline (width) dimension. You can also assign a container-name for targeted queries. Example: .card-wrapper { container-type: inline-size; container-name: cards; } Then use @container cards (min-width: 500px) { ... }.
@media) respond to the viewport (browser window) sizeâthey're page-level. Container Queries (@container) respond to a specific parent element's sizeâthey're component-level. This means a card component can adapt its layout based on its own container's width, regardless of the viewport size. Container queries enable truly reusable, self-contained responsive components.
@supports or progressive enhancement approaches. Check caniuse.com for the latest data.
min-width, max-width, min-height, max-height, and logical properties like min-inline-size. Combine conditions with and, or, and not. You can also use container query length units: cqw (1% of container width), cqh (1% of container height), cqi, cqb, cqmin, and cqmax. These work like viewport units but are relative to the container.
container-name values to different elements and target them specifically in your @container rules. For example: @container sidebar (max-width: 300px) { ... } will only match a container named "sidebar". If you omit the nameâ@container (min-width: 600px) { ... }âit matches the nearest ancestor container of any name.
container-type set (this playground's container already has container-type: inline-size). 2) Check your selector targets elements inside the container. 3) Ensure your @container syntax is correctâuse parentheses around conditions. 4) If using a named container, verify the name matches. Click "Apply CSS" after editing to ensure changes take effect. The status indicator shows green when the style is live.
Experiment with scrollâstate container queries to style elements when they are stuck, snapped, or overflowed. Experimental.
Build the same layout with both Grid and Flexbox side by side. See the code differences and visual results.
Dynamically blend two colors using the CSS colorâmix() function in different color spaces. Copy the exact CSS snippet. No JS required.
Enter a URL and drag a slider to change the viewport width smoothly. See exactly where your layout breaks. No iframe limits.
A replica of the famous Flexbox Froggy game: solve alignment puzzles by writing CSS. Progress saved locally. Fun frontend learning.
Add grid items beyond defined tracks and see how implicit rows/columns expand. Set sizes interactively. Master the grid.
Paste your CSS and get a sorted list of all custom properties defined under :root with their values. Quick audit.
Style the <progress> and <meter> elements with crossâbrowser CSS. Adjust colors and sizes. Copy the final styles.
Use named grid lines instead of column numbers. See how they simplify placement. Visual, interactive learning.
Fetch a website's CSS and extract :root custom properties (ââcolor) to reveal its design token palette. For learning and inspiration.
Enter a component name and generate a complete RTL test file with render, screen, and common assertions. Fast testing setup.
Enter a CSS selector and see its specificity broken down into A,B,C columns with a visual weight comparison. Learn specificity.
Set a custom accent color for checkboxes, radios, range, and progress. See the browserâs rendering. Copy the CSS.
Paste a list of hex colors and generate CSS custom properties for them. Create your design token file instantly.
See every HTML input type in one page. Check browser support and styling. Copy sample markup. Quick frontend reference.
Write modern CSS color functions like oklch(), lab(), hwb() and see the rendered color with fallback. Copy compatible code.
Style an `<input type='range'>` with custom track and thumb. Crossâbrowser CSS. Preview and copy the code.
Grid of all 148 named CSS colors. Hover to see detail, click to copy the name or hex. Essential frontend reference.
Use the lightâdark() CSS function to change colors based on color scheme. Build a simple dark mode toggle with one property.
Customize Bootstrap 5 variables visually. See the live preview. Download the generated SCSS or CSS file.
Design custom radio buttons and checkboxes using pure CSS. Choose sizes, colors, and animation. Copy the code.
Paste a stylesheet and extract every unique color (hex, rgb, hsl) into a palette. Swatches displayed. Copy as JSON.
Test the upcoming contrastâcolor() CSS function. Get white or black automatically for a given background. See it live.
Pick a color in the DisplayâP3 space and get the CSS color() function. See the difference from sRGB. For modern design.
Type a CSS color name like 'tomato' or 'mediumseagreen' and instantly get its hex code and preview. Complete named colors list.
Set the number of lines and generate the CSS for multiâline truncation using the standard lineâclamp and fallback. Quick copy.
Design a light and dark theme by picking colors for backgrounds, text, and links. Get the CSS for both themes. Local.
Interactively create colors in HWB space and get the CSS hwb() function. Simplifies tint/shade workflows. Live preview.
Select shoe size and riding style to get recommended deck width. Visual comparison.
Generate a range of tints and shades from a single hex color. Ideal for data visualization, UI design systems, and Tailwind custom palette creation. Local tool.