CSS Grid Overlap Demo - Online Layered Layout Techniques
Place multiple grid items into the same cells to create overlapping layouts. Learn the technique visually. Copy code.
UD5 Toolkit
Understand CSS Grid auto-fill vs auto-fit with real-time visual comparison
auto-fill and auto-fit tell the browser to create as many grid tracks as possible within the available space. The key difference: auto-fill preserves empty tracks (leaving visible gaps where items could go), while auto-fit collapses empty tracks and lets existing items stretch to fill the available space. Think of auto-fill as "reserving seats" and auto-fit as "only setting up chairs for people who showed up."
minmax(), the behavior difference is barely noticeable. The minmax(min, 1fr) pattern is essential because the 1fr maximum allows auto-fit items to grow and fill extra space when empty tracks collapse. If you use a fixed value like minmax(150px, 150px), both auto-fill and auto-fit behave identically — columns stay at 150px and the extra space just sits unused. The 1fr is what makes the visual difference dramatic.
repeat(auto-fit, 200px) is valid CSS — it creates as many 200px columns as fit, and collapses empty ones. However, without 1fr, there's no stretching behavior. The items stay at exactly 200px. The minmax() function unlocks responsive flexibility: columns can be at least the minimum but expand when space allows. This is what makes auto-fit layouts feel truly fluid and responsive.
minmax()'s minimum value, both auto-fill and auto-fit behave the same: they create a single column, and the item width is clamped to the container width (potentially overflowing if content is larger). This is why choosing a sensible minimum (like 200px–280px) is important for mobile-responsive designs. Test your layout at narrow widths to ensure items don't become unusably small.
minmax(140px, 1fr): available width ≈ 620px − (n−1)×12px (where n is the number of columns). The browser then determines how many 140px columns fit. Gaps consume space, so larger gaps reduce the maximum number of columns. This is why adjusting gap can sometimes cause items to wrap or unwrap.
auto-fill and auto-fit are part of the CSS Grid Level 1 specification and have excellent browser support — all modern browsers including Chrome 57+, Firefox 52+, Safari 10.1+, and Edge 16+ support them fully. They're safe for production use. Internet Explorer 11 had partial grid support but did not support auto-fill/auto-fit, so if IE11 support is required, you'll need a fallback like @supports queries.
auto-fill/auto-fit with fixed track sizes in grid-template-columns. For example: grid-template-columns: 200px repeat(auto-fill, minmax(150px, 1fr)) 80px; — this creates a 200px sidebar, flexible center columns, and an 80px end column. The auto-fill/auto-fit only applies to the repeated section, while fixed tracks remain constant. This is powerful for complex responsive layouts.
minmax() maximum must be a flexible unit like 1fr — if it's a fixed pixel value, items won't stretch. (2) Ensure there are fewer items than the maximum possible columns — if all tracks are filled, auto-fill and auto-fit look identical. (3) Check that grid items don't have explicit max-width or justify-self constraints that override the grid's sizing. Use your browser's DevTools grid inspector to see exactly how tracks are being sized.
Place multiple grid items into the same cells to create overlapping layouts. Learn the technique visually. Copy code.
Control image‑orientation: from-image vs none. See how the browser interprets EXIF rotation. Fix portrait photos.
Experiment with scroll‑state container queries to style elements when they are stuck, snapped, or overflowed. Experimental.
Hover over tiles to see every CSS cursor value in action. Quick visual reference for choosing the right UI feedback.
Configure how your PWA launches: focus existing or create new. Test with the launch_handler manifest field.
Build a horizontal scroll‑snap container with configurable snap‑type and alignment. Perfect for image galleries.
Compare all CSS easing presets side by side on a bouncing ball. See which curve fits your UI animation.
Query the permission state of camera, microphone, geolocation, and more. See the response and learn the API.
Process audio faster than real‑time with OfflineAudioContext. Apply filters and export the result. Dev tool.
Toggle image‑rendering: auto, pixelated, crisp‑edges on a scaled image. Essential for pixel art display.
Drop files onto a zone and see a preview with name, size, and type. Copy the JavaScript pattern for your site.
Demonstrate how to add custom headers and POST‑like functionality to EventSource using a polyfill. Code and example.
Scroll a container and see how sticky elements behave. Adjust top, bottom, and scroll margins. Copy the code.
See how overflow: visible, hidden, scroll, and auto behave with real content. Clone to test with your text.
Try all object‑fit values (fill, contain, cover, scale‑down) on an image. Adjust object‑position. Copy the CSS.
See the difference between clone and slice on inline boxes that break across lines. Useful for multi‑line headings.
Use CSS masks and fixed backgrounds to create a unique parallax reveal effect. Copy the code. No JavaScript.
Add rows and columns, merge cells, and set gaps visually. Get the grid‑template CSS and HTML. Fast layout prototyping.
Render the classic Stanford Bunny with a basic WebGPU pipeline. Rotate and zoom. Check if your browser supports WebGPU.
See how scroll‑padding and scroll‑margin affect the position of elements when using anchor links or scroll‑snap. Visual.
See how align‑items: baseline works in grid to align different font sizes on the same baseline. Visual guide.
Test the experimental Translation API to translate text between languages directly in the browser, without cloud calls. Check support and copy the JavaScript starter.
Apply a convolution filter (blur, sharpen) using a Web Worker. See the UI stay responsive while processing. Learn multithreading in the browser.
Toggle scrollbar‑gutter: stable to reserve space for the scrollbar and avoid content jumps. Visual demo with two columns.
Acquire and release locks across tabs. Prevent race conditions in IndexedDB or localStorage. Visual queue and lock state.
Register a periodic background sync to fetch fresh data even when the tab is closed. Understand the API and limits.
Test the Fullscreen API: request fullscreen on a colored div, detect changes, and copy the JavaScript boilerplate.
See the View Transitions API in action. Cross‑fade and morph between two states. Copy the JavaScript starter code.
Experiment with CSS Grid properties visually. Add rows, columns, and areas. See the grid in action and copy the code.
Find safe mixing ratios for the classic elephant toothpaste demonstration. Volume adjustments for different container sizes.