CSS Utilities Grid

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 wa-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 wa-grid with a wa-gap-* class to adjust the spacing between cells, or add wa-span-grid to an individual item to make it span every column.

Examples

Link to This Section

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

Sizing

Link to This Section

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 property.

Gap

Link to This Section

By default, the gap between grid items uses --wa-space-m from your theme. You can add any of the following wa-gap-* classes to an element with wa-grid to specify the gap between items:

Span Grid

Link to This Section

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

    No results