Runs in your browser — nothing is uploaded
How to use CSS Grid Generator
Set columns, rows and gaps to build a grid, then copy the CSS and HTML.
- Adjust the controls — the preview updates live.
- Copy the generated CSS.
- Paste it into your stylesheet.
About CSS Grid Generator
CSS Grid lays content out in rows and columns at once. grid-template-columns: repeat(3, 1fr) makes three equal columns, and gap sets the space between them.
repeat(auto-fit, minmax(200px, 1fr)) creates as many columns as fit, each at least 200 px wide, so the grid adapts to the screen without media queries.
Questions
What is the fr unit?
A share of the free space in the grid. Columns of 1fr 2fr make the second twice as wide as the first.
auto-fit or auto-fill?
auto-fit stretches the columns to fill the row when there are few items; auto-fill keeps empty column tracks.