Picture a blog archive of three hundred posts poured into identical 340px boxes because a competitor's site "feels more modern." The page gets long, and every card shouts at the same volume. Where is the reader supposed to start?
That's the trap with cards. They're the pattern everyone reaches for, and almost nobody asks whether the content wants to be a card in the first place.
TL;DR: An
auto-fitgrid covers most card collections in three declarations, subgrid keeps titles and links aligned, and a container query lets one card work in a sidebar and a main column. Native masonry (display: grid-lanes) runs in Safari 26.4 and later only, as of 2026-10-15. Nielsen Norman Group's own guidance is blunt: cards are a poor choice when users need to compare options (Nielsen Norman Group, 2016).
Which CSS Builds a Card Grid That Fits Any Width?
Start with the grid, because it's the one you'll use most. The frame above runs every block in this article as one stylesheet, so edit it as you read.
/* 1. The card grid: the column count comes from the width, not from breakpoints */
.grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr));
gap: 1rem;
}
Three declarations. No media queries. The browser divides the available width into as many 14rem columns as fit, then shares the leftover space out through 1fr. I rendered 24 cards with this rule in headless Chromium 145 at five viewport widths, 320, 480, 700, 960 and 1200px, and got 1, 1, 2, 3 and 4 columns. The column count came from the width alone. Nothing in the stylesheet knows the word "breakpoint".
Two details earn their keep. The first is min(100%, 14rem) instead of a bare 14rem. Put a bare minimum into a 200px wrapper and the track stays 224px wide, so the grid overflows by 24px (I measured exactly that). The min() caps the track at the container width and the overflow disappears. Small thing. It's also the thing that breaks a card grid inside a narrow sidebar on a phone.
The second is auto-fit against auto-fill. MDN puts it plainly: auto-fit behaves like auto-fill, except that after placing the items it collapses any empty repeated tracks (MDN). In practice, with two cards in a 900px container, auto-fit stretched each one to 442px, while auto-fill left them at 289px with empty tracks beside them. Which looks better? Depends on the page. A featured pair usually wants the stretch. A filtered result list that drops from twelve cards to two usually doesn't, because suddenly two giant cards appear from nowhere.
If the gaps and padding in that grid come from a ladder rather than from guesses, the spacing scale generator builds one in a few seconds. For the wider Grid and Flexbox picture, our CSS Grid and Flexbox guide covers the primitives this article builds on.
How Do You Line Up Titles and Links Across Cards?
Here's the annoying bit about card grids. The cards are the same height, because grid stretches them, but what's inside them isn't aligned. One title wraps to three lines, its neighbor's to one, and the "Read" links end up at different heights. Does that matter? The eye reads a row of links as a line across the page, and a staircase of them looks like a rendering bug.
Subgrid fixes that. The card stops being its own little grid and borrows the rows of the grid it lives in.
/* 2. Subgrid: title, body and link sit on rows shared by a whole row of cards */
.grid--sub .card {
display: grid;
grid-row: span 3;
grid-template-rows: subgrid;
row-gap: 0.5rem;
}
Each card spans three rows of the parent grid (title, body, link) and uses those rows as its own. Every card in a row of cards now shares the same row tracks, so the title row is as tall as the tallest title in that row, and so on down.
I measured it on 12 cards at 960px, with titles from two to nine words and teasers from 5 to 40 words. With plain stacked cards the Read links sat up to 98px apart inside a single row of cards. The common workaround, a flex column with margin-top: auto on the link, pinned the links to the same line, but the body text still started up to 20px apart because the titles wrapped differently. With subgrid, both spreads were 0px. All numbers come from Chromium 145, which is one engine, so check yours.
Support isn't a worry. MDN's compatibility data lists subgrid from Chrome 117, Firefox 71 and Safari 16. Firefox shipped it first, in version 71 on 2019-12-10, and Safari and Chrome followed in 2022 and 2023. One caveat I'd flag: subgrid needs the card to be a direct child of the grid. Wrap each card in an extra element and the rows stop being shared.
What Does a Card Do When Its Container Changes, Not the Window?
A media query asks how wide the window is. For a card, that's often the wrong question. The same card might sit in a three-column grid on the homepage, in a 16rem sidebar and in a full-width featured slot, all at the same viewport width.
Container queries ask the right question: how much room does this card actually have?
/* 3. Container query: the card reflows by the width of its own slot */
.slot {
container-type: inline-size;
}
.card--media {
display: grid;
gap: 0.75rem;
}
@container (min-width: 30rem) {
.card--media {
grid-template-columns: 9rem 1fr;
align-items: start;
}
}
The .slot is the wrapper that gets measured. The card inside it is plain markup, with the thumbnail stacked on top by default and moved to a 9rem column on the left once its slot reaches 30rem. In the frame, the same markup sits in a 16rem slot and a 38rem slot. I checked the computed styles at two viewport widths. In the 16rem slot (256px) the card stayed a single column at both 360px and 1100px viewports. In the 38rem slot it became a 144px plus 421px two-column layout at 1100px, and fell back to one column at 360px, where the slot itself shrank to 328px. The viewport didn't decide anything. The slot did.
Container queries work in Chrome 105, Firefox 110 and Safari 16, per MDN's data. The trade-off worth knowing: the element with container-type can't style itself from its own query, which is why the extra .slot wrapper exists. If you want the longer argument for sizing against the container instead of the window, our responsive breakpoints strategy post has it.
Is Masonry Possible in CSS Today?
Yes, two ways, and they behave differently.
The first works everywhere and has for years. CSS columns.
/* 4. Masonry with CSS columns, which every current browser runs */
.masonry {
columns: 14rem;
column-gap: 1rem;
}
.masonry > * {
break-inside: avoid;
margin-bottom: 1rem;
}
Items flow down the first column, then the next. break-inside: avoid stops a tile from splitting across two columns. I put 24 text tiles of varied length through it at 960px, and compared them with the same 24 in the auto-fit grid from earlier. The grid, with its row heights set by the tallest tile in each row, came to 1143px tall. The columns version came to 968px. That's 175px, or 15%, less scrolling for the same content, and the column bottoms ended up 98px apart.
Now the catch, and it's a big one. Columns fill top to bottom. In my 24-tile test the tiles at the top of the three columns were items 1, 9 and 17. Item 2 sits under item 1, not beside it. Tab through the links in such a layout and focus goes down the first column and jumps to the top of the second. Would a reader sorting by newest expect that? For a mood board it doesn't matter. For a "latest posts" list where position means recency, it's a bug.
The second way is native. The CSS Working Group's answer is display: grid-lanes, and it's the first time masonry has a spec'd home. WebKit introduced it on December 19, 2025, with this syntax.
/* 5. Native masonry, only where the browser has it (Safari 26.4+ on 2026-10-15) */
@supports (display: grid-lanes) {
.masonry {
display: grid-lanes;
grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr));
gap: 1rem;
}
.masonry > * {
margin-bottom: 0;
}
}
So what's the status today? I checked the data rather than a blog post. MDN's browser-compat-data release v8.1.6, published on 2026-10-15, lists display: grid-lanes as supported from Safari 26.4, with Chrome and Firefox both marked as not supported. Safari 26.4 shipped on 2026-03-24, according to the same dataset, and WebKit's own feature post for that release says "Safari 26.4 adds support for Grid Lanes." MDN's page labels the feature experimental and not Baseline. WebKit's January 2026 status post says Chrome and Edge have it behind a flag, and that Firefox Nightly still answers to an older grid-template-*: masonry syntax.
One of those sentences deserves repeating: one browser. That's all. If your audience is mostly Chrome, grid-lanes is a progressive enhancement and nothing more.
That's exactly how the block above is written. The columns rule is the base. Inside @supports (display: grid-lanes) the container switches to real lanes, and the margins go away because gap does that job. Items then land in whichever lane places them nearest the top, so reading order follows height instead of the source order. WebKit's flow-tolerance property, which defaults to 1em, decides how big a height difference has to be before an item prefers a different lane.
I have to be straight about my own testing. Chromium 145 returned false for CSS.supports('display', 'grid-lanes'), so the @supports branch never ran in my measurements. I tried to open the same file in the Safari on this Mac, but the automation prompt hung and I dropped it. Everything I've said about how lanes behave comes from WebKit's and MDN's documentation. The columns numbers above are mine.
When Do Feeds and Pagination Beat an Endless Grid?
Feeds, the single column of cards that keeps loading, solve a different problem. Who's the reader there, and what are they after? Order matters (newest first, or ranked), width doesn't, and the reader has no particular target. Nielsen Norman Group's advice is that infinite scrolling works best when people scroll through homogeneous items with no specific goal, and that it's a poor fit when they need to find something specific or compare items far apart in the list (Nielsen Norman Group, 2022).
The same article names the two costs that bite archives. Infinite scroll can make the footer impossible to reach, and sites often don't save the reader's spot, so Back drops them at the top and they scroll past everything again.
Numbers are scarce here. The best sourced set I found is Baymard Institute's e-commerce research, published in 2016. Among the top 50 US e-commerce sites it benchmarked, only 8% used a Load more button, and of those with one, over 90% didn't return the shopper to their spot in the list after Back. Baymard's suggestion for category pages was 10 to 30 products on first load, another 10 to 30 lazy-loaded, then a Load more button at a threshold of 50 to 100 items. It also found that infinite scrolling can be downright harmful to usability, in particular for search results and on mobile. Those are product lists, not blog archives, and they're ten years old. They're a starting range, not a law.
Whatever pattern you pick, the markup underneath should still be plain links.
<nav aria-label="Archive pages">
<a href="/blog/page/2/">Older posts</a>
</nav>
Google's documentation says it can only crawl a link that is an <a> element with an href, and that it can't reliably pull URLs out of elements that behave as links through script events (Google Search Central). A feed that loads more cards by script but also ships that one anchor keeps every page reachable for crawlers, keyboard users and anyone with JavaScript switched off.
And be honest about whether your content is sequential at all. A resource library where every item matters equally regardless of date doesn't want a feed. It wants a filterable grid.
When Is a Card the Wrong Container?
More often than designers like to admit. Nielsen Norman Group's definition of a card is a container for a few short, related pieces of information, and its guidance has a list of what cards are bad at. Cards are less scannable than lists. They're less appropriate when people search. They take more space. And they're a poor choice when users need to compare options (same article, Page Laubheimer, 2016).
The 2025 NN/g video summary on card view versus list view says the same thing in fewer words: list view is easy to sort and space efficient, while card view is visually engaging and creates effective groupings (Nielsen Norman Group, 2025). That's all the page claims, and I'd rather not stretch it. It doesn't claim that lists are faster in a timed test.
For comparison there's a better container still. Comparison tables, per NN/g, let users see and compare multiple important attributes at a glance, because the options sit in columns and the attributes in rows (Nielsen Norman Group, 2024). Plan cards on a pricing page are the classic case. Three cards with different feature lists make the reader do the table in their head, which is why our pricing page layout analysis keeps coming back to row-aligned feature lists.
Here's my opinion, and you can disagree. Will the reader ever hold two of these items side by side? Then don't make them cards. Make them rows.
How Do You Choose Between Grid, Masonry, and Feed?
Which comes first, the layout or the content? The content. Items of similar shape that people browse: an auto-fit grid with subgrid. Genuinely uneven visual items where order is irrelevant: columns masonry, with grid-lanes layered on top for Safari. A stream where the order is the point: a feed, with real links underneath. Anything that gets compared: a table.
A card layout is a promise that every item deserves equal attention. Break that promise and the grid feels broken even when the CSS is flawless.
The decision lives one level above the code. And don't let a competitor audit make it for you. "Their site uses cards" isn't a content requirement.
| Pattern | Best for | CSS | Weakness |
|---|---|---|---|
| Uniform grid | Browsable items of similar shape: product tiles, article previews | auto-fit + minmax(), subgrid for alignment | Truncation or empty space on uneven content |
| Container-query card | Same card in a sidebar, a main column and a feature slot | container-type: inline-size + @container | Needs a wrapper that is the container |
| Masonry (columns) | Uneven images where order doesn't matter | columns + break-inside: avoid | Reads down columns, ragged bottom edge |
| Masonry (grid-lanes) | Same, as a progressive enhancement | display: grid-lanes | Safari 26.4+ only as of 2026-10-15 |
| Feed | Chronological or ranked streams with no specific goal | Single column plus real pagination links | Footer and position loss; wrong for comparison |
| Table or list | Anything users compare or search | Plain table or list | Less visual |
Build this grid yourself
Cards are a grid problem before they're a styling one. The generator below lays out a twelve-column shell with a sidebar and a metric strip. Change the density and count how many columns each region gets, which is the number the auto-fit rule above is quietly choosing for you.