Tailwind Class Sorter
Sort Tailwind classes and detect conflicting utilities with a winner explanation.
OpenGet a Pinterest-style stacked layout from plain CSS columns, with no script or library.
Enter a value between 2 and 6 columns.
The container rule sets columns and the child rule prevents splits.
Add class masonry to the wrapper around your cards.
Copy the snippet or download masonry.css.
A testimonials section has quotes of very different lengths, and a regular grid leaves big empty gaps under the short ones. A columns-based layout lets each card sit directly under the one above it. Pick the column count and copy the rule.
Set the number of columns (2 to 6) and the tool writes two rules. The .masonry container gets column-count and a 1rem column-gap. Its direct children get break-inside: avoid, so a card never splits across two columns, and a 1rem bottom margin to space the stacked items. Add the class to any wrapper and the children flow into the columns.
The main thing to know before you use it: CSS columns fill top to bottom, column by column. Item 1 sits at the top of the first column, item 2 under it, and the second column starts only when the first is full. For galleries and quotes that is fine, but for content where reading order matters (newest first, ranked lists) the visual order will confuse people. In that case use the CSS grid layout tool and accept even row heights. For responsive behaviour, lower column-count inside a media query, which the media query and clamp() starter helps you set up. More layout tools are in the CSS generators category.
The output updates as soon as you change the number.
Keyboard shortcut
Answers for this tool. For site-wide help, open the FAQ hub.
That is how CSS multi-column layout works. Content flows down the first column, then continues at the top of the next. If order across rows matters, use grid instead.
Native masonry layout is still being specified and is not available in all stable browsers. The columns approach works everywhere today.
Make sure break-inside: avoid is on the direct children of the masonry container. If cards are wrapped in another element, move the rule to that wrapper.