Skip to content
MewixMewix

CSS grid generator

Set column count, row count, and gap on a equal-fr grid, watch numbered cells resize, and copy the grid-template rules.

Updated by the Mewix team

Responsive grid columns without media queries here

The generator emits equal columns with grid-template-columns: repeat(n, 1fr) and up to four explicit rows. Column count ranges 1–6; row count ranges 1–4; gap ranges 0–32px. That is ideal for prototyping dashboards or card galleries where every track shares space evenly.

Grid versus flexbox for the same layout

Flexbox distributes space along one primary axis and wraps rows when allowed. Grid assigns both column and row tracks upfront, which is simpler when you need a photo gallery with fixed column count regardless of item height. Use the flexbox generator when alignment inside a single row or column matters more than defining a full matrix.

Copied CSS does not include grid-template-areas or minmax fr tracks—only repeat with 1fr. For auto-fit responsive columns, extend the copied line manually after you paste it.

Why do my grid items not stretch?

Default stretch behaviour depends on item content and any align rules you add elsewhere. This output only defines the container grid. Add align-items: stretch on the grid if you need explicit stretch semantics.