Keep every word.
Lose the empty space.
A browser-measured layout solver that finds the shortest card arrangement while keeping every word, the same text size and reading order.
Readers scroll less without losing context. Editors can change the words without hand-tuning rows. The optimum applies to these row rules, not every possible design.
Try your own words, then check the result. Nothing to install.
Explore the working layout
The living layout
How the solution is checked
The browser is the ruler
Each card is rendered off screen at every allowed column width. Its actual height becomes the input to a small mathematical problem: where should each row end?
- Start at the last card. Try every allowed number of cards in the next row, from one to four.
- A row is as tall as its tallest card. Add the shortest possible layout for the cards that remain. Keep the cheapest choice.
- Walk forward through those choices. Render every card once, in its original order.
This is dynamic programming: reuse the best answer for each remaining group instead of repeating work. It finds the exact minimum for ordered rows of equal-width cards, with the chosen font, minimum width, fixed padding and 12 px gaps. It does not search other fonts, reordered cards, masonry columns or arbitrary page designs.
Check the result independently enumerates every permitted row arrangement, compares the minimum, and checks the visible cards for missing text, overlap and overflow. It also renders both layouts to reconcile calculated and actual heights. Measurements belong to this browser and this width, not every device.
| Check | Observed result |
|---|