Advertisement
Guide
About the CSS Grid Template Areas Builder
grid-template-areas lets you draw a page layout in CSS as a little text map: each quoted string is a row, and each word names the area that fills that cell. Children then just say which area they belong to with grid-area.
Here you paint the map instead of typing it. The builder keeps the strings aligned, checks each area is a valid rectangle, and writes a mobile layout too.
Areas must be rectangles
Every named area has to form one solid rectangle. An L-shape, or the same name in two separate places, makes the whole grid-template-areas declaration invalid, and the browser silently drops it. The builder outlines any offending area in red.
Rearranging for mobile
Because the layout lives in CSS rather than the HTML order, a media query can redraw it completely. The generated query stacks the areas in one column on small screens, in the order of your area list, without touching the markup.
How to use it
- 1Start from a preset or set the number of columns and rows.
- 2Add area names and paint them onto the cells.
- 3Set column and row sizes and the gap.
- 4Copy the CSS and HTML.
Frequently asked questions
What does a dot mean in grid-template-areas?
A . is an empty cell that belongs to no area. Use it for gutters or blank space in the layout.
How is this different from the Flexbox / Grid playground?
That tool explores the alignment properties of flex and grid containers. This one is for designing a named page layout cell by cell.
Can an area span rows and columns?
Yes — paint it across several cells in a rectangle, and it spans them all.
What sizes can I use for columns?
Any CSS track size: 1fr, 200px, auto, 20%, minmax(0, 1fr), fit-content(300px) and so on.
Why use minmax(0, 1fr) instead of 1fr?
1fr will not shrink below its content’s minimum width, so long words or code blocks can overflow. minmax(0, 1fr) allows it to shrink.
