CSS Grid Generator
Design a CSS Grid visually — set track sizes and gaps, drag to name areas, and copy the container CSS and HTML.
Grid
Column sizes
Row sizes
Layout presets
Preview — drag across cells to create a named area
Area names may contain letters, digits, - and _ only.
Areas
CSS
HTML
How to use the CSS Grid generator
- Set how many columns and rows you need, then give each track a size —
frfor flexible shares,pxor%for fixed,autoto fit the content. - Type a name and drag across cells in the preview to turn that rectangle into a grid area; areas appear in the list and in
grid-template-areas. - Copy the container CSS and the matching HTML.
FAQ
What does 1fr actually mean?
fr is a fraction of the leftover space after fixed tracks and gaps are taken out. Three columns of 1fr 2fr 1fr split the remaining width into four shares of 25%, 50% and 25%.
Do I have to use named areas?
No. Named areas make a layout readable at a glance, but you can leave them empty and place children with grid-column and grid-row instead. Cells that belong to no area are written as a dot in grid-template-areas.
Why must areas be rectangles?
The CSS specification only allows rectangular areas — every cell with the same name has to form a solid rectangle. This tool therefore always creates a rectangle from the cell you start dragging on to the one you release on.