Toolstia / CSS grid generator

CSS grid generator

Choose the number of columns and rows, the gap and the sizes, see the grid at once, and copy the CSS and sample HTML.

1
2
3
4
5
6

fr means one share of the free space, so 1fr 2fr gives the second column twice the width of the first. The responsive option uses repeat(auto-fit, minmax(...)) so columns wrap on narrow screens without media queries.

How it works

  1. Pick equal, responsive or custom columns.
  2. Set rows and gaps.
  3. Copy the CSS and HTML.

Equal columns

repeat(3, 1fr) makes three columns that share the width equally.

Responsive columns

repeat(auto-fit, minmax(200px, 1fr)) fits as many columns of at least 200px as the width allows, and wraps the rest. No media queries are needed.

Custom sizes

Mix units such as 200px 1fr 2fr. Here 1fr and 2fr split the leftover space one to two.

Gap

The gap property sets the space between rows and columns without margins on the items.

Questions

What does fr mean?

One fraction of the free space in the grid container.

Does it work in all browsers?

Yes, CSS grid is supported by all current browsers.

Is my data stored?

Everything happens in your browser, and nothing you enter is sent anywhere.