How to use the CSS Grid Generator
- Set the number of columns and rows and the gaps — or start from a preset like Holy grail.
- Edit the track sizes (above the grid for columns, left for rows):
1fr,240px,auto,minmax(0, 1fr). - Drag across cells to create an area and give it a name like
headerorsidebar. - Copy the CSS and the HTML skeleton into your project.
Grid areas in a nutshell
grid-template-areas lets you draw the layout with names: each string is a row, each word a column, and a dot (.) leaves a cell empty. Children are placed with grid-area: name, so the CSS reads like a picture of the page.
.layout {
display: grid;
grid-template-columns: 240px 1fr;
grid-template-areas:
"header header"
"sidebar main";
}
Track sizes
| Value | Meaning |
|---|---|
1fr | one share of the free space |
minmax(0, 1fr) | like 1fr, but long content can’t stretch the column |
auto | as big as the content |
240px, 20rem | a fixed size |
repeat(auto-fill, minmax(200px, 1fr)) | as many columns as fit — great for card grids |
Areas must be rectangles — the tool only lets you draw rectangles, so the CSS is always valid. For a single row or column of items, flexbox is often simpler. Related: Clamp Calculator, CSS Formatter.
Also searched as: grid layout generator, css grid builder, grid-template-areas generator, css grid template, responsive grid generator, grid css online, layout generator.
Tools that pair well with the CSS Grid Generator
- Border Radius Generator — Round the corners of any box: drag one slider for all corners or set each corner separately, switch to elliptical corners for blob and leaf shapes, and copy the shortest valid border-radius CSS.
- Box Shadow Generator — Stack multiple shadow layers, tweak offsets, blur, spread and opacity on a live card, then copy the box-shadow or text-shadow CSS.
- CSS Gradient Generator — Design a gradient visually — drag color stops, change the angle or type, start from a preset — and copy production-ready CSS with a solid fallback color.
- PX to REM Converter — Convert between pixels, rem and em with your own root font size — or paste a whole stylesheet and convert every px value in one go.