Skip to main content
Layout & StructureLevel 2

Masonry Grid

瀑布流

WebMobileDesktopDifficulty: Medium

Dynamic multi-column layout where variable-height items stack tightly without vertical gaps.

01

Live Demo

Actually clickable
Live Demo Playground
Landscape
Mountain Cabin
Industrial
Minimal Watchmaker Product
Editorial
Typography Specimen
Architecture
Architectural Shadow
Branding
Color Palette Card
Masonry flows variable-height cards tightly without awkward vertical gaps at the bottom.

What you just saw:Pinterest or Red/Xiaohongshu feeds: a tall vertical photo on the left, a square card on the right followed immediately by a medium recipe snapshot, with columns staggering naturally without dead space.

02

What it actually is

Masonry solves the problem of awkward whitespace left by mismatched media aspect ratios in rigid grids. Mimicking stonemasons fitting uneven bricks, each arriving card slots immediately beneath the shortest column. This eliminates gaping holes, producing a lush, uninterrupted waterfall of rich imagery and social cards.

masonrywaterfall gridpinterest layoutdynamic flowstaggered grid
03

Anatomy · What it's made of

  1. Columns自适应列数

    Adaptive column tracks scaling from 2 to 4 based on viewport

  2. Variable-Height Card不定高卡片

    Self-sizing cards expanding to natural image aspect ratios

  3. Gutter Gap列间与行间距

    Consistent horizontal and vertical gutters between brick tiles

  4. Break Avoid防断裂规则

    CSS break-inside: avoid preventing cards from splitting across columns

04

When to Use

When it fits, and when it doesn't
Masonry Grid usage recommendations
SituationUse it?
Visual inspiration feeds, photography galleries, and Pinterest-style boardsYes
User-generated content (UGC) where image dimensions cannot be normalizedYes
E-commerce buyer reviews and social commerce showcasesYes
Strict horizontal comparison tables where row alignment is mandatoryNo
Sequential procedural step-by-step documentation workflowsNo

Using staggered heights for data tables where users must scan horizontally across matching rows.

Omitting break-inside-avoid, allowing browsers to awkwardly bisect cards across columns.

05

Similar Patterns

Don't mix these up
06

How to tell AI

Three levels of prompt

Add the component name and specifics

Implement a responsive masonry feed using CSS columns (2 columns on mobile, 3 to 4 on desktop): cards with 12px rounded corners, 16px bottom margins, break-inside-avoid, holding images, titles, and engagement counts.

07

Don't just say this to AI

Bad → Better

Don't say this to AI

List cards with uneven heights.

Say this instead

Implement an adaptive masonry layout: columns-2 sm:columns-3 lg:columns-4 gap-4, apply break-inside-avoid mb-4 to card wrappers, maintain natural aspect ratios, and prevent layout thrashing.

08

Share this card

Social-ready

Turn this pattern into a 3:4 or 1:1 knowledge card and export it as PNG right in the browser. No backend needed.