CSS Grid Template Areas Builder

Turns a text layout, one row per line with names for areas and dots for empty cells, into grid-template-areas CSS, per-area classes and a coloured preview.

Use the tool

Why this tool exists

The grid-template-areas property is one of the most readable ways to lay out a page, but typing the quoted strings by hand is fiddly, and CSS silently drops the whole declaration if an area is not a rectangle. Here you draw the layout in plain text, for example header header header on one line and sidebar main main on the next. The tool checks that every row has the same number of cells and that each named area forms one rectangular block, then outputs the container rule plus a class per area and shows a coloured preview. It is a quick sketching aid for dashboards, article layouts and landing pages, and it runs entirely in your browser.

How to use it

  1. Write the layout, one row per line, with a name per cell and a dot for an empty cell.
  2. Set the column and row sizes, the gap and the container selector.
  3. Read the generated CSS, check the preview, and copy the code.

Frequently asked questions

What makes an area invalid?

Every named area must fill a single rectangle, and each row must have the same number of cells. An L-shaped or split area, or an uneven row, produces an error that names the problem.

How do I leave a cell empty?

Use a dot, or several dots, as the cell name. Empty cells are written as dots in the grid-template-areas value and get no class.

What are valid area names?

Names must start with a letter, underscore or hyphen and then use letters, digits, underscores or hyphens. They become class names, so keep them short and meaningful.

Does the preview match my real page?

The preview uses your column, row and gap values with placeholder colours and fixed minimum height. It shows the structure, not your content or breakpoints.