GODRICH
#css-animation#button#loader#transition#scroll#dashboard#ui#design-trends

04Preview grid — reading aspect ratios and computing a gap-free layout

Carrying each image's naturalWidth-to-naturalHeight ratio into a --ratio CSS variable and passing it to aspect-ratio lets the grid remember each image's shape, and margin math rather than object-fit keeps every tile full inside a square cell; mixed landscape and portrait images never wobble the row height.

Best forProduct photo uploads, portfolio assembly

naturalWidthnaturalHeightCSS custom properties
Preview grid — reading aspect ratios and computing a gap-free layout
Open in a new tab

04 Preview grid — reading aspect ratios and computing a gap-free layout — Measured area 26.197% · moving frames 7/23Original by GODRICH · SCSS and React ship in the zip · Drag and Drop File Upload UI: 9 Computed Dropzones

The post this demo lives in

Drag and Drop File Upload UI: 9 Computed Dropzones - preview of all 9 demosDrag and Drop File Upload UI: 9 Computed DropzonesDropped files turn into previews computed from their bytes: type, size and count drive the layout, images get pixel-read See all demos in this post

If you like this effect - similar demos