ZeroUtil

CSS Grid Generator

Build CSS Grid layouts visually with live preview.

1
2
3
4
5
6
7
8
9
3
3
10px
10px
Content Areas

No content areas defined. Add an area to create spanning cells.

CSS
.grid-container {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: 10px;
}

How to Use the CSS Grid Generator

Adjust the column and row counts with the sliders, or type custom templates like "1fr 2fr 1fr" or "repeat(3, 1fr)" directly. Set column and row gaps to control spacing. The live preview updates instantly.

Click "+ Add Area" to define named content areas that span multiple cells. Set the column and row start/end values to control each area's position. Click "Copy CSS" to grab the generated code.

Frequently Asked Questions

What is CSS Grid?

CSS Grid is a two-dimensional layout system that lets you arrange elements in rows and columns simultaneously. It is ideal for building complex page layouts.

What does "1fr" mean?

"fr" stands for fractional unit. "1fr" takes one equal share of the available space. "1fr 2fr" means the second column is twice as wide as the first.

What is the difference between gap and margin?

Gap controls the space between grid cells without adding space outside the container. Margins add space around the outside of individual elements.

Can I nest grids?

Yes. Any grid item can itself be a grid container. Just apply "display: grid" to the child element and define its own columns and rows.

Ad

More CSS & Design