UtilDojo

Popular

Menu

CSS Grid Generator — Visual Layout Builder

  • This tool runs entirely in your browser. Nothing you enter or upload is sent to a server.

Layout — drag across cells to create an area

header
nav
main
aside
footer
Presets

Tracks

3
Column sizes
Any CSS track size: 1fr, 200px, auto, minmax(100px, 1fr)…
3
Row sizes
Any CSS track size: 1fr, 200px, auto, minmax(100px, 1fr)…
12px
12px

Areas

  • 1×3
  • 1×1
  • 1×1
  • 1×1
  • 1×3

CSS

.container {
  display: grid;
  grid-template-columns: 200px 1fr 200px;
  grid-template-rows: auto 1fr auto;
  grid-template-areas:
    "header header header"
    "nav main aside"
    "footer footer footer";
  gap: 12px;
}

.header {
  grid-area: header;
}

.nav {
  grid-area: nav;
}

.main {
  grid-area: main;
}

.aside {
  grid-area: aside;
}

.footer {
  grid-area: footer;
}

HTML

<div class="container">
  <div class="header"></div>
  <div class="nav"></div>
  <div class="main"></div>
  <div class="aside"></div>
  <div class="footer"></div>
</div>

About this tool

Choose the number of columns and rows and their sizes (fr, px, auto, minmax…), set the gap, then drag across cells to create a named area such as header, sidebar or main.

The generator writes the container CSS — grid-template-columns, grid-template-rows, gap and grid-template-areas — plus a rule for each area, so the layout can be pasted into a stylesheet as-is.

Presets for common page layouts (holy grail, sidebar, card grids) give you a starting point.

Frequently asked questions

What does 1fr mean?

fr is a fraction of the free space. Three columns of 1fr share the width equally; 2fr 1fr makes the first column twice as wide as the second.

Grid or flexbox — which should I use?

Grid is for two-dimensional layouts (rows and columns together, like page layouts). Flexbox is for one-dimensional rows or columns, like navbars and button groups.

Can areas overlap?

Named grid-template-areas must be rectangles and cannot overlap; the tool prevents overlapping selections.

Related tools