CSS Grid Studio

Design CSS Grid layouts visually and copy ready-to-use CSS.

Updated:

100% client-side

Layout

Preview

Select an area chip, then click or drag over cells to paint it.

Generated CSS


    

What is CSS Grid Studio?

CSS Grid is a browser layout system for arranging elements into rows and columns, like a spreadsheet — instead of stacking things with floats or flexbox tricks. CSS Grid Studio lets you design a grid layout visually (set rows, columns, gaps and named areas by clicking and dragging) and copy the exact, ready-to-use CSS it generates, without hand-writing the grid syntax yourself.

How to use CSS Grid Studio

  1. Set the number of Rows and Columns, and the row/column gap, in the Layout panel.
  2. Name an area (e.g. "header") in the area field and click Add, then click or drag across cells in the Preview to paint that area onto them.
  3. Repeat for each area you need (sidebar, main, footer, etc.).
  4. Watch the Generated CSS panel update live as you paint.
  5. Click Copy to copy the finished CSS to your clipboard.

How CSS Grid areas work

grid-template-areas lets you name regions of a grid and lay them out as a visual map — one quoted string per row, each word naming which area that cell belongs to, and a period (.) for an empty cell. Every named area must form a solid rectangle; the browser rejects the whole declaration otherwise:

.container {
  display: grid;
  grid-template-columns: 1fr 2fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 12px;
  grid-template-areas:
    "header header header"
    "sidebar main main";
}
.header { grid-area: header; }
.sidebar { grid-area: sidebar; }
.main { grid-area: main; }

The fr unit distributes leftover space after fixed-size tracks (like px) are subtracted — a 2fr track takes twice the leftover space of a 1fr track. This tool generates all of it from what you paint, per the W3C CSS Grid Layout Module Level 2 spec — no external libraries.

Examples

1. App shell with a full-width header and a fixed-width sidebar. 2 rows × 2 columns, column tracks 240px 1fr, row tracks auto 1fr, 16px gaps; header painted across row 1, nav and main in row 2. If the header holds a large title, a fluid clamp() font size lets it scale with the 1fr column:

.container {
  display: grid;
  grid-template-columns: 240px 1fr;
  grid-template-rows: auto 1fr;
  gap: 16px 16px;
  grid-template-areas:
    "header header"
    "nav main";
}
.header { grid-area: header; }
.nav { grid-area: nav; }
.main { grid-area: main; }

2. An L-shaped area the browser would reject. On a 2 × 2 grid, hero is painted over three cells (an L) and promo over the fourth. A named area that isn't one filled-in rectangle makes the whole grid-template-areas declaration invalid, so instead of emitting CSS the browser would throw away, the tool leaves hero out and warns you:

  grid-template-areas:
    ". ."
    ". promo";
}
.promo { grid-area: promo; }

These areas are not solid rectangles, so they were left out of grid-template-areas: hero. grid-template-areas requires every named area to form one solid rectangular block.

The fix is to split the L into two rectangular areas (for example hero across row 1 and a separate area in the bottom-left cell). Once the layout is final, you can minify the generated rules along with the rest of your stylesheet in the HTML, CSS & JS Beautifier and Minifier. The rectangle rule is defined in the CSS Grid Layout Module Level 2 specification.

Frequently asked questions

What is grid-template-areas?

It's a CSS Grid property that lets you name regions of your grid and lay them out as a visual ASCII-art map, one quoted string per row, instead of positioning every item by row/column numbers.

What does the fr unit mean?

fr stands for "fraction." A track sized 1fr takes one share of the leftover space in the grid after fixed-size tracks (like px) are subtracted; 2fr takes twice as much leftover space as 1fr.

Why does my area not generate valid CSS?

grid-template-areas requires every named area to form a solid rectangle of cells. If you paint a non-rectangular shape, this tool flags it and excludes it from the generated CSS instead of shipping a broken declaration.

Can I export just the grid-template-areas string?

Yes, it's included at the top of the generated CSS block alongside grid-template-columns, grid-template-rows and gap, plus one grid-area rule per named area.