How to use it
- Type the Columns (track sizes) and the Rows (track sizes). For two columns, 200px 1fr gives a fixed sidebar and a flexible main area.
- Set the Column gap (px) and the Row gap (px), and give the container a Class name.
- Type a name under Area name to paint, keep Paint selected and click the cells that belong to that area. Choose Erase to clear cells.
- Copy the CSS box, or check the Preview, before you paste the rules into your stylesheet.
Track sizes and repeat()
Each track is a size in the grid: a length in px or a percentage, a flexible size in fr that shares the space left over in proportion to its number, auto, min-content or max-content. A minmax(minimum, maximum) gives a track a range. The CSS Grid Layout specification sets out how each one is sized.
repeat(3, 1fr) writes the same track three times. repeat(auto-fill, minmax(200px, 1fr)) makes as many tracks as fit the width of the box. Because that count depends on the box, every track in an auto-fill or auto-fit repeat needs a fixed size, and the tool cannot draw named areas over it.
grid-template-columns: 200px 1fr; grid-template-rows: auto 1fr auto; gap: row-gap column-gap;
Named areas
The grid-template-areas property takes one string for each row of the grid. The names in a string are the cells of that row, and a full stop stands for a cell that is in no area. Each name must fill one rectangle, because the browser cannot place a name in an L shape or in two separate blocks.
The names are placed on the grid by the container, and each child takes its place with grid-area. The tool writes one rule for each name, so the element with that class fills its cells.
- Use one row of names for each row of tracks, with the same number of names in every row.
- Choose names that describe the part of the page, such as header, sidebar or main, because the rules are written with those names as classes.
Worked example: a page with a header, sidebar, content and footer
The default layout has two columns, 200px and a flexible 1fr, and three rows: auto for the header, 1fr for the middle and auto for the footer. The gap is 16 px in both directions. The header is painted across both columns, the sidebar and the main content share the middle row, and the footer is painted across both columns at the bottom.
The CSS starts with .layout { display: grid; grid-template-columns: 200px 1fr; grid-template-rows: auto 1fr auto; gap: 16px; } and then grid-template-areas with three rows: "header header", "sidebar main" and "footer footer". Each name has its own rule with grid-area, so the header element fills the first row.
Frequently asked questions
What is the difference between fr and auto?
A fr track shares the space left over after the fixed tracks, in proportion to its number, so 1fr 2fr gives the second track twice the width of the first. An auto track is as wide as its content needs and then shares any spare room.
Why can I not paint areas over auto-fill tracks?
auto-fill and auto-fit decide the number of tracks from the width of the box, so the number of cells is not known while you edit. Named areas need a fixed count, so the tool asks you to remove auto-fill or auto-fit when areas are painted.
Why does each area get its own rule?
grid-template-areas places the names on the grid, but each item still has to say which cell it fills, and grid-area does that. The tool writes one rule for each name, using a class of the same name.
What happens to cells that I do not paint?
A cell in no area is written as a full stop in grid-template-areas. Nothing is placed in that cell by the named areas, so it stays empty unless you place an item there another way.
Which browsers support CSS grid?
CSS grid is supported in all current major browsers. If your visitors use older versions, check the layout in those versions before you rely on the named areas.
Is my layout sent or saved anywhere?
No. The grid, the preview and the CSS are made in your browser. Nothing is stored or sent to our server, so copy the CSS before you leave the page.
Sources
- W3C: CSS Grid Layout Module Level 1
- W3C: CSS Grid Layout Level 1, grid-template-areas
- W3C: CSS Gaps Module Level 1, the gap shorthand
- MDN: grid-template-areas
Figures and text last checked on Tuesday, November 10, 2026.