#reponsive

Ana Tudor 🐯anatudor
2025-02-20

Because this keeps getting asked over and over... subgrid is how you get such cards whose grids align even with varying component heights.

reddit.com/r/css/comments/1itg

Both the card wrapper and the cards get `display: grid` and the rest you can see in the Styles panel in DevTools below.

Live on @codepen

codepen.io/thebabydino/pen/QwW

Screenshot showing the page with grid overlays. DevTools is open on the right, showing the relevant code.

```
main, article { display: grid }

main { grid-template: repeat(3, max-content)/ repeat(auto-fit, min(35ch, 100%)) }

article {
  grid-row-end: span 3;
  grid-template-rows: subgrid
}
```
Ana Tudor 🐯anatudor
2025-02-20

Because somebody asked, here's my take on the adaptive grid with a fixed row item spanning all columns reddit.com/r/css/comments/1ir2 - it all boils down to just 3 declarations as seen below.

Minimal @codepen example:
codepen.io/thebabydino/pen/pvo

Code and desired result for different available space cases.

```
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, min(var(--w-col), 100%))
}

.fixed-item { grid-area: 2/ 1/ span 1/ -1 }
```

Client Info

Server: https://mastodon.social
Version: 2025.07
Repository: https://github.com/cyevgeniy/lmst