CSS Grid Generator — Free Visual Grid Builder
Visually design complex CSS Grid layouts and export production-ready code.
Grid Cheat Sheet
display: grid;
Initializes the grid container. Everything inside becomes a grid item.
grid-template-columns
Defines the width of each column. Use fr, px, or %.
grid-template-rows
Defines the height of each row in the container.
gap
Sets the spacing between rows and columns simultaneously.
grid-column
Determines which column an item starts and ends in.
grid-area
Shorthand for row-start, col-start, row-end, and col-end.
Frequently Asked Questions
Grid: Layout in Two Dimensions
The handful of patterns that cover most layouts
Most production grids are one of these:
| Pattern | Template | Use |
|---|---|---|
| Equal columns | repeat(3, 1fr) | Card rows, feature sections |
| Sidebar + content | 240px 1fr | Docs, dashboards |
| Responsive auto-fit | repeat(auto-fit, minmax(250px, 1fr)) | Galleries that reflow without media queries |
| Holy grail | Named areas: header, sidebar, main, footer | Whole-page scaffolding |
| 12-column system | repeat(12, 1fr) + span | Design-system layouts |
The two concepts that unlock grid
fr units distribute remaining space — 240px 1fr 1fr means: give the sidebar its 240, split the rest equally. auto-fit + minmax is the famous one-liner: columns at least 250px wide, as many as fit, stretched to fill — responsive galleries with zero media queries. Add gap for spacing (it replaced margin hacks) and you've covered 90% of real grid usage.
Grid or flexbox?
Grid places items in two dimensions (rows and columns known in advance); flexbox flows items in one direction and wraps. Page scaffolding, card matrices, dashboards → grid. Toolbars, nav rows, centering, content of unknown count → the flexbox playground. They nest happily — grid for the page, flex inside each card. Spacing and sizing stay consistent with the px to rem converter, and corner/shadow polish comes from border radius.