Skip to main content

BETANow in public beta.Public betaBeta

日本語Español

GAL-002 Published · Updated

Masonry gallery

A design that packs portrait and landscape photos into columns at their original ratios.

Wireframe (desktop) | Masonry gallery

Masonry gallery UI design (desktop wireframe)

Wireframe (mobile) | Masonry gallery

Masonry gallery UI design (mobile wireframe)

What changes on mobile

  1. Two columns: In three columns the photos are too small to show the composition.
  2. Fewer items: A run of portrait photos would make the list very long.

Before you choose this pattern | Masonry gallery

Good fit

  • Portrait and landscape photos mixed, to be shown uncropped
  • Work, food, interiors: the composition itself is what readers should see
  • Readers browse the photos and pick what catches their eye

Poor fit

  • Readers should see the photos in a set order (packing by column makes the order hard to read; the <a href="/patterns/en/gallery-grid/">grid gallery</a> works better)

Why this wireframe works | Masonry gallery

Photos shown without cropping

Photos keep their original ratios, so portrait and landscape shots alike show their full composition.

No gaps despite differing ratios

Photos are packed into each column from the top, so photos of differing ratios leave no large gaps between them.

A title under each photo

Whatever the ratio, the title and description sit under the photo in the same form. Photos of different sizes are read the same way.

Two columns on mobile

Three columns make the photos too small on mobile, so they sit in two. Because a run of portrait photos gets long, fewer items are shown.

Common mistakes | Masonry gallery

Reading and keyboard order that differs from the visual order

When packed by column, the visual order and the HTML order may not match. Avoid it for lists where order matters, or build it so the visual order follows the HTML.

Layout shifting as photos load

Laying photos out before their sizes are known makes the layout move while loading. Specify each photo’s aspect ratio in advance.

One extremely tall photo stretching the list

A single very tall photo lengthens its whole column. Set a maximum ratio for the list and crop photos that exceed it.

Three columns on mobile

Three columns on mobile make the photos too small to show their composition. Use two columns or one on mobile.

Visual order that differs from reading order

With cards of different heights, the visual order can drift from the HTML and Tab order. Keep the visual order, HTML order and Tab order the same, and do not reorder things visually with CSS. Check with a screen reader and the keyboard.

FAQ | Masonry gallery

Can masonry be built with CSS alone?

CSS multi-column layout (columns) gives a close result. Note that items then flow top to bottom within each column, which differs from reading across.

How should the photo order be decided?

Because items are packed by column, fine ordering does not come across. Put the photos you most want seen first, and avoid it for lists ordered by date or similar.

Should pressing a photo enlarge it?

When the point is showing composition, enlarging lets readers see the detail. See the lightbox.

Related pages

Share this pattern

Send this page to your team or your design partner.

Was this pattern useful?

Written by

Yuta Okano

ENVY DESIGN Inc.

CEO / Director / Designer

14 years in the web industry. Has worked on more than 500 web projects, from corporate and recruiting sites to e-commerce. Focuses on information architecture, direction and design, from planning websites to improving them. In recent years he has focused on AIO (AI optimization) and GEO, helping sites get cited by generative AI search such as ChatGPT, Perplexity and Google AI Overviews.

Review and revision history

  1. Published AvatarYuta Okano Pattern published