CSS Masonry Layout Generator
Free CSS masonry layout generator. Build Pinterest-style walls with grid-template-rows: masonry or a multi-column fallback, tune columns, gap and items, preview live, and copy the HTML and CSS. No JavaScript needed.
Loading tool...
What is CSS Masonry Layout Generator?
The CSS Masonry Layout Generator builds Pinterest-style card walls in pure CSS. Modern mode uses grid-template-rows: masonry with an automatic multi-column fallback for older browsers, fallback mode uses column-count with break-inside: avoid, and columns, gap and item count are all configurable. The live preview shows varied card heights like a real page, and the HTML and CSS copy out as a self-contained snippet with no JavaScript required.
Key Benefits
- Tight Pinterest-style packing without equal-height row hacks
- Works today in every browser via the multi-column fallback
- No masonry libraries: a few lines of pure CSS
- Visual tuning of columns and gap with live feedback
- Output that drops into plain HTML, React or Vue unchanged
Common Use Cases
- •Photo gallery and portfolio walls with mixed image heights
- •Blog card grids where summaries vary in length
- •Dashboard widget boards that pack densely
- •Product listing pages with variable aspect ratios
- •Learning how real CSS masonry differs from the fallback
How to Generate a CSS Masonry Layout
- Set the layout: Choose the column count, gap and item count. The live preview re-renders immediately with varied card heights.
- Pick the mode: Modern mode uses grid-template-rows: masonry with a @supports fallback. Fallback mode uses multi-column CSS that works in every browser today.
- Copy the code: Copy the HTML and CSS separately and paste them into your project. No JavaScript and no libraries are needed for the layout itself.
Key Features
- Modern grid-template-rows: masonry mode with @supports fallback
- Column-count fallback mode that works in every browser
- Configurable columns, gap and item count
- Live preview with varied card heights like a real page
- Separate copy buttons for the HTML and the CSS