Snug Gallery / Guides

Justified row gallery on Shopify: one line, no cropping

The Row layout puts a few photos of different shapes on one line at one height. How the widths are worked out, how many images suit it, and what phones do.

Three photos from a shoot: one wide shot of the studio, one tall portrait of the maker, one square close-up of the product. Put them in a grid and two get cropped. Put them in masonry and they stack into columns of uneven length. What you wanted was the thing magazines do: all three on one line, the same height, edge to edge, each at its own shape. In Snug Gallery that is the Row layout. This guide explains how it sizes the images, where it works, and the three ways it goes wrong.

What Row does, in one sentence

Row places every image in the gallery on a single line, gives them all the same height, and makes each one as wide as its proportions need so that the line fills the section exactly.

Nothing is cropped. A landscape photo ends up wide, a portrait ends up narrow, and the height is whatever makes the widths add up. This is usually called a justified layout, after justified text, where each line is stretched to meet both margins. Flickr and Google Photos made it familiar. They build many rows; Snug Gallery's Row builds one, on purpose. For many rows of mixed shapes, masonry is the layout to use, and the layout comparison guide covers how the two differ.

How the widths are worked out

Each image has an aspect ratio: width divided by height. A 3:2 landscape is 1.5, a square is 1, a 2:3 portrait is about 0.67. The layout hands out the available width in proportion to those numbers.

Take the three photos from the introduction in a section 1200 pixels wide, with the default 12 pixel spacing. Two gaps leave 1176 pixels for images. The ratios add up to 3.17. The landscape gets 1.5 parts of that, about 557 pixels. The square gets 371. The portrait gets 248. Divide any of those widths by its ratio and you get the same height, 371 pixels, which is the point.

You never enter these numbers. The block reads each image's proportions from Shopify and the browser does the division, so the row adjusts itself when the section gets wider or narrower, and when you add or remove an image.

The same sum is used for something shoppers never see. Each image tells the browser roughly what share of the screen it will occupy, so a narrow portrait in a five-image row downloads a small file and the wide shot next to it downloads a larger one. A row of five does not cost five full-width downloads.

How many images suit a row

Because everything shares one line, the count decides the height. More images means a shorter row. In the 1200 pixel section:

Three mixed images give a row about 370 pixels tall. Five give roughly 220. Eight are down near 130, and twelve are a strip of thumbnails about 75 pixels high. None of these is wrong, but they are different things. Three to five reads as a set of photographs. Six to eight reads as a band. Past that it is a contact sheet, and shoppers will only see the images properly if the lightbox is on.

So choose the count for the job. A row of four between two sections of a home page is a divider with content in it. A row of six logos under the hero is a press strip, and the guide to logo walls uses Row for exactly that. If you have twenty photos, this is not the layout for them.

Three ways it goes wrong

Too few tall images. Two portraits alone would need a row almost 900 pixels tall to fill 1200 pixels of width. The layout stops that: no image is allowed to be taller than 640 pixels, or 70% of the screen height if that is smaller. When the cap applies, each image stays at its proportions, sits centred in its share of the row, and you see space on either side of it. If your row has visible gaps left and right of the photos, this is why. Add a third image or a landscape one and the row drops under the cap.

One extreme shape. A panorama three times as wide as it is tall, next to a portrait, takes about 970 of the 1200 pixels and leaves the portrait a 216 pixel sliver. The arithmetic is doing what it should. The fix is editorial: give the panorama its own gallery block, or crop it to something closer to 2:1 before uploading.

Expecting the Image shape setting to apply. The block has an Image shape setting with Square, Landscape, Portrait and Wide options. Row ignores it, and so does masonry, because both exist to keep original proportions. If you want every tile the same shape on one line, choose Grid, set the columns to the number of images and pick the shape there.

What happens on phones

A justified row of five on a 390 pixel wide phone would be about 60 pixels tall. So under 750 pixels of screen width the layout changes. The images are laid out in columns, using the Columns on mobile setting, every tile the same width, and they wrap onto as many lines as they need. Each image still keeps its own proportions, so within a line a portrait is taller than a landscape. The height cap is lifted too.

With two columns on mobile, a row of four becomes two lines of two. With one column it becomes a simple stack. Three images in two columns leaves the third on its own line at half width, aligned to the start. If that bothers you, use an even number of images or set mobile columns to one.

Check this in the theme editor's mobile preview before publishing. The desktop row and the phone layout are different enough that approving one tells you little about the other.

Captions, links and the lightbox

Everything that works on a tile in other layouts works here. An image can open the lightbox, link to a product or collection, and carry a caption. Captions below the image make the bottom edge of the row uneven if one caption wraps to two lines and its neighbour does not, so for a clean strip use overlay captions or keep them to a few words. The captions guide compares the modes.

For a row of small images, leave the lightbox on. It opens the full image at up to 2048 pixels wide whatever size the tile was, and arrow keys or a swipe move along the row.

Setting one up

  1. In the Snug Gallery app, create a gallery, choose the Row layout and add three to six images. Mixed shapes are fine. Put them in the order you want them left to right.
  2. Open the theme editor, go to the template where the row belongs, and add the Snug Gallery app block.
  3. Choose the gallery in the block settings. The layout comes with it.
  4. Set Spacing between images. 12 pixels is the default; 4 to 8 gives a tighter, more editorial strip, and 0 makes the images touch.
  5. Set Columns on mobile to 1 or 2 and look at the mobile preview.
  6. If the row is too tall or shows side gaps, add an image. If it is too short, remove one. The count is the height control.

When to pick something else

Row is a narrow tool. Pick Grid when every image should be the same shape. Pick Masonry when there are more than eight images and none should be cropped. Pick Carousel when there are many images and one line of space. Pick Slider when one image at a time should have the whole width. Row is for the case in between: a handful of photographs of different shapes that belong together and deserve to be seen side by side, whole.

Frequently asked questions

How do I make a justified image row on Shopify without code?

Add the Snug Gallery app block in the theme editor, pick a gallery with three to six images that uses the Row layout. The block reads each image's proportions and sizes the widths so the images share one height and fill the section. No Liquid or CSS is involved.

Why are there empty spaces beside the images in my row?

The row hit its height cap. No image is shown taller than 640 pixels or 70% of the screen height, so with only one or two tall images each one is centred in its share of the row. Adding another image, or a wider one, brings the natural height under the cap and the spaces close.

Can the Row layout wrap onto several justified rows?

Not on desktop. Row is one line, however many images the gallery holds, so each extra image makes the row shorter. On screens under 750 pixels wide it switches to equal-width columns that wrap. For several rows of uncropped images on desktop, use the Masonry layout.

Does Row crop my photos?

No. Every image keeps its original proportions, and the Image shape setting is ignored for this layout. The only time an image is shown smaller than its slot is when the height cap applies, and then it is scaled down whole, not cropped.

More guides