A. Gugu

Grid layouts without a framework

12 Nov 2026 · css

Two lines of CSS replace most of the grid utilities I used to import:

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
  gap: 1.25rem;
}

The part worth remembering is auto-fit together with minmax(): the column count follows the container, no media queries needed, and it degrades to a single column on narrow screens.

For a fixed sidebar I still reach for grid-template-areas, mostly because it reads well when the layout is non-trivial.