The Justified layout fills each row to a target height while keeping every image at its natural proportions, producing clean, flush left and right edges. It is the gallery-of-record look for large, mixed sets, like a printed contact sheet where every row lines up neatly without cropping any photo.
Location Gallery Settings → Layout → Layout Type → Justified
How it works #
Justified arranges items into rows of an approximately equal height. Within each row, every image keeps its original proportions, and FotoGrids adjusts the row’s exact height slightly so the images stretch to meet both edges of the container. The result is rows that all read at a similar height with flush, justified edges, much like the text in a justified paragraph.
Because rows must fill the width, the number of images in each row varies with their shapes: a row of wide panoramas holds fewer images than a row of portraits. Justified uses a dedicated proportional thumbnail derivative so it can measure each image and pack the rows correctly.
Justified keeps every image at its original proportions, so the Item Aspect Ratio setting does not apply to this layout.
Generating the thumbnails
The proportional version Justified relies on is created automatically for any image you upload after installing FotoGrids. For images that were already in your media library beforehand, that version may not exist yet, which can leave rows mis-sized until it is generated.
FotoGrids includes a **Regenerate Thumbnails** tool that creates the missing sizes for your existing images, so there is no need to install a separate thumbnail-regeneration plugin for this. Running it once gets your whole library ready for the Justified layout. The tool is under **FotoGrids → Tools**.
When to use it #
Justified is built for big galleries of mixed proportions where a tidy, even result matters: event coverage, a full wedding set, a travel archive, a stock library. It is the most space-efficient way to show a lot of varied images while keeping the arrangement orderly.
Settings #
The Justified settings are split across two subtabs: **Rows** controls how rows are packed, and **Pagination** controls how pages break (and appears only when pagination is on).
Rows
Target Row Height
The approximate height every row aims for, set per device. Actual heights vary slightly so each row can fill the width.
| Setting | Target Row Height |
| Range | Desktop 80–300, Tablet 60–300, Mobile 60–200 |
| Units | px |
| Default | Desktop 200 Tablet 160 Mobile 120 |
A taller target gives fewer, larger images per row; a shorter target packs more, smaller images into each row.
Row Height Tolerance
How far a row’s actual height may drift from the target so images fit neatly.
| Setting | Row Height Tolerance |
| Range | 0–100 |
| Units | % |
| Default | 25 |
A low tolerance keeps rows very close to the target height but can force awkward image counts per row. A higher tolerance gives the packer more freedom to fit a natural number of images per row, at the cost of more height variation between rows.
Last Row Behavior
How the final row of the Gallery is handled when it does not have enough images to fill the width.
| Setting | Last Row Behavior |
| Options | Keep Natural Justify Left Center Right Hide |
| Default | Keep Natural |
The options:
- Keep Natural — leaves the last row at the target height, aligned to the start, with whatever empty space remains.
- Justify — stretches the last row to fill the width like every other row, even if that makes its images noticeably taller.
- Left, Center, Right — keeps the natural height and positions the row’s images to that side.
- Hide — removes the partial last row entirely, leaving a perfectly rectangular block.
With pagination on, Last Row Behavior applies only to the very last page. Trailing rows on earlier pages are handled by the Pagination subtab below.
Max Rows
Limits how many rows the Gallery shows.
| Setting | Max Rows |
| Range | 0–50 |
| Default | 0 (unlimited) |
Leave at 0 to show every row. A non-zero value caps the height of the Gallery, which is useful for a preview block that links elsewhere.
Pagination
These settings appear only when pagination is turned on, and they tidy the trailing row of each intermediate page so page breaks do not leave ragged rows.
Page Trailing Row
How the last row of every page (except the final one) is finished.
| Setting | Page Trailing Row |
| Options | Fill with Items Same as Last Row |
| Default | Fill with Items |
| Visible when | pagination is enabled |
Fill with Items nudges the item count per page slightly so each page ends on a clean, full row. Same as Last Row finishes each page’s trailing row using your Last Row Behavior choice instead.
The three settings below fine-tune the Fill with Items behaviour.
Adjustment Window
How far the actual items-per-page count may drift from the configured value to land a clean trailing row.
| Setting | Adjustment Window |
| Range | 0–50 |
| Units | % |
| Default | 20 |
| Visible when | Page Trailing Row is set to Fill with Items |
For example, 20% of a 20-item page allows the page to hold between 16 and 24 items so the trailing row comes out clean.
Clean Row Threshold
How full the trailing row must already be for the page to be left alone.
| Setting | Clean Row Threshold |
| Range | 0–100 |
| Units | % |
| Default | 85 |
| Visible when | Page Trailing Row is set to Fill with Items |
When the trailing row already fills at least this much of the width, the page is left as is. Below the threshold, items are added or removed within the adjustment window to clean it up.
Snap Direction
Whether to prefer adding or removing items when tidying the trailing row.
| Setting | Snap Direction |
| Options | Auto Prefer Remove Prefer Add |
| Default | Auto |
| Visible when | Page Trailing Row is set to Fill with Items |
Auto removes items when the trailing row is less than half full and adds items when it is more than half full. Prefer Remove and Prefer Add force one direction.
How this layout affects other settings #
Justified leaves the broader settings available: Pagination, Filtering, and Sorting all work, and the Lightbox, Captions, item styling, and Hover Effects apply as normal. Like Masonry, Justified overrides the Thumbnail Size setting in the Media tab with its own proportional derivative so rows pack correctly, and the Item Aspect Ratio and Item Fit settings do not appear, because items keep their original shape.
Tips and recommendations #
Target Row Height and Row Height Tolerance work together. Start with the row height that feels right for your content, then raise the tolerance if rows are being forced into awkward image counts, or lower it if the height variation between rows looks untidy. The default 25% tolerance is a sensible middle ground for most sets.
For a Gallery that needs a perfectly rectangular edge, set Last Row Behavior to Hide so the partial final row is dropped. If you would rather keep every image, Justify stretches the last row to match, though it can make a row of one or two images look oversized.
The Pagination subtab matters most on large galleries split across many pages. Leaving Page Trailing Row on Fill with Items keeps every page ending on a clean row, which looks far tidier than letting pages break mid-row. The defaults handle this well, so adjust the window and threshold only if you want tighter control over how many items land on each page.