CSS UtilitiesGrid

Grid

A grid places its children in evenly-sized columns that shrink, grow, and reflow as the container resizes, without any breakpoints to manage. Drop any number of items into cs-grid and the utility figures out how many fit on each row based on the container’s width and the minimum column size you’ve asked for. It’s the quickest way to build card galleries, product listings, dashboards, and any content that should adapt from one column on a phone to several on a desktop.

Set --min-column-size to change the threshold at which items start to wrap, pair cs-grid with a cs-gap-* class to adjust the spacing between cells, or add cs-span-grid to an individual item to make it span every column.

Examples

Grids work especially well for card lists and content designed for browsing.

Tulip

Tulipa gesneriana

Peony

Paeonia officinalis

Poppy

Papaver rhoeas

Sunflower

Helianthus annuus

Daisy

Bellis perennis
Population (Zion) 251,999 -3% 
Minds Freed 0.36% +0.03% 
Agents Discovered 3 ±0% 
Sentinels Controlled 208 +1% 

Size

By default, grid items will wrap when the grid’s column size is less than 20ch, but you can set a custom minimum column size using the --min-column-size custom property.

Gap

By default, the gap between grid items uses --cs-space-m from your theme. Add any cs-gap-* class to change the spacing between cells.

Span Grid

You can add cs-span-grid to any grid item to allow it to span all grid columns. With this, the grid item occupies its own grid row.