CSS Layout Tool
CSS Grid
Generator
Build responsive CSS Grid layouts visually. Define named areas, set columns, rows, gap, alignment — then copy production-ready CSS and HTML instantly. No login, no install, runs in your browser.
grid-template-columns: repeat(3, 1fr);
gap: 16px;
grid-template-areas:
"hero hero aside"
"main main aside";
| Area | Cells | Span | Quality |
|---|
How it works
Four steps to a production grid
Set dimensions
Choose how many columns and rows your grid needs. Adjust the column template, row template, and gap values to match your design system.
Define areas
Add named areas like hero, sidebar, or footer. Each area gets a unique grayscale shade on the canvas.
Paint the grid
Select an area from the palette, then click or drag across grid cells to assign them. The template areas string updates live as you paint.
Copy the code
Copy the generated CSS and HTML with one click, or download the files. Drop them straight into your project — no cleanup required.
Frequently Asked Questions
What is CSS Grid?
CSS Grid is a two-dimensional layout system that lets you define both columns and rows simultaneously. It replaces complicated float and positioning hacks with a clean, declarative syntax understood by all modern browsers.
What does grid-template-areas do?
grid-template-areas lets you name rectangular regions of a grid container. Each child element is then placed into its named area using grid-area, making layouts self-documenting and easy to rearrange.
What is minmax() in CSS Grid?
minmax(min, max) defines a size range for a track. minmax(0, 1fr) is safer than bare 1fr because it prevents overflow when content is wider than the column.
What is the fr unit?
The fr (fraction) unit distributes available space proportionally after fixed-size tracks are placed. 1fr 2fr 1fr gives the middle column twice the space of the sides.
How is CSS Grid different from Flexbox?
Flexbox is one-dimensional — it handles rows or columns independently. CSS Grid is two-dimensional — you control both axes at once. Use Grid for page-level layouts and Flexbox for component-level alignment.
What is auto-flow: dense?
The dense keyword tells the browser to fill in earlier gaps if a smaller item appears later in the source order — great for masonry-style card grids.
Is this tool free to use?
Yes — completely free, no account required. The tool runs entirely in your browser. Nothing is uploaded to a server. Your grid designs stay private.
How do I make a responsive grid?
Use repeat(auto-fill, minmax(240px, 1fr)) as your column template. This creates as many columns as fit, each at least 240px wide, without any media queries.
Container Properties
| display | grid | inline-grid |
| grid-template-columns | Track definitions for columns |
| grid-template-rows | Track definitions for rows |
| grid-template-areas | Named layout regions |
| gap | row-gap column-gap shorthand |
| column-gap | Space between columns |
| row-gap | Space between rows |
| grid-auto-flow | row | column | dense |
| grid-auto-columns | Size of implicit columns |
| grid-auto-rows | Size of implicit rows |
| justify-items | Horizontal cell alignment |
| align-items | Vertical cell alignment |
| justify-content | Horizontal grid alignment |
| align-content | Vertical grid alignment |
Item Properties
| grid-area | Named area or shorthand position |
| grid-column | start / end line shorthand |
| grid-row | start / end line shorthand |
| grid-column-start | Column line to start at |
| grid-column-end | Column line to end at |
| grid-row-start | Row line to start at |
| grid-row-end | Row line to end at |
| justify-self | Override item's horizontal alignment |
| align-self | Override item's vertical alignment |
| place-self | align-self justify-self shorthand |
| z-index | Stacking order for overlapping items |
Useful Functions & Keywords
| repeat(n, size) | Repeats a track size n times |
| minmax(min,max) | Track size range constraint |
| fit-content(val) | Clamps track to content width |
| auto-fill | Fill row with as many tracks as fit |
| auto-fit | Collapse empty tracks after fill |
| fr | Fraction of remaining space |
| span N | Span N tracks from start position |
| -1 (negative line) | Count from the end of the grid |
| subgrid | Inherit parent's track lines |
| masonry | Experimental masonry axis |
| . (dot) | Empty cell in template-areas |