InstrumentsCSS Grid Generator
CSS Grid Generator
Build CSS Grid layouts with a live preview and copy-ready CSS, using px or rem gaps.
CSS Grid Generator
One track per line, for example 1fr, 240px, minmax(0, 1fr) or auto.
One track per line. Leave empty for automatic rows.
rem gaps assume a 16px root font size.
Preview: 3 of 3 cells. Approximate preview: one cell per track entry; repeat() counts as one.
.grid {
display: grid;
grid-template-columns: 1fr 1fr 1fr;
gap: 16px;
justify-items: stretch;
align-items: stretch;
}FAQ
Do I need a fixed number of columns?
No. Each line is one track. Use fr units for flexible tracks, px or rem for fixed tracks, and minmax() to set a minimum and a maximum. The generator checks every track before it writes CSS.
Why does the rem option change the gap?
A rem gap scales with the reader's font size setting. The generator divides your px value by 16, the usual browser default root size. If a site sets a different root font size, rem values scale from that size instead.
Does the preview show every cell?
The preview draws up to 48 cells so large grids stay quick to render. The CSS output is not limited by this preview cap. The preview is approximate: it draws one cell per track entry, and repeat() counts as one.
Related tutorials
§04Toolbox
Related tools
Personalize your path
Choose your experience level once.
Next Step
Build fundamentals after each tool run so you can apply concepts with confidence.