A Settings Component, Built Almost Entirely With CSS Grid

Adam Argyle's settings component tutorial on web.dev is a CSS-heavy walkthrough, and one idea stands out: using grid "just for gap." Grid is a powerful tool, but it doesn't have to exercise every feature each time it's used.

Light-touch grid

In the tutorial, grid shows up for modest jobs — as a stand-in for a border between elements, and for general spacing. It's a case of gap doing work that margin might once have handled.

RAM grids, with a minimum that never bites

The tutorial also credits Una Kravets with the name for flexible grids: RAM, for repeat(auto-minmax(..., 1fr)). The familiar trick sizes a flexible number of columns without media queries. The added twist is calling min(), so even the smallest layouts have no hard-coded floor — say, when 100% comes out below 10ch.

.el {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(10ch, 100%), 35ch));
}

More in the post

The article packs in further techniques as well, including "color pops" driven by :focus-within. Argyle has written similar component-focused pieces for tabs and a sidenav.