CSS grid generator

CSS grid arranges items in rows and columns defined on the container with grid-template-columns and grid-template-rows.

Features

  • Responsive optionauto-fit with minmax needs no media queries.
  • Live previewNumbered cells show the order.
  • Runs in your browserNothing is uploaded and no account is needed.

How to use the css grid

  1. Set columns, rows and gap.
  2. Or turn on responsive columns.
  3. Copy the CSS.

How auto-fit works

repeat(auto-fit, minmax(160px, 1fr)) creates as many columns of at least 160px as fit, then shares the remaining space.

Frequently asked questions

What is the fr unit?

A share of the free space.

auto-fit or auto-fill?

auto-fit collapses empty tracks; auto-fill keeps them.

Can items span columns?

Yes, with grid-column: span 2.

Related tools