CSS Grid Layout Generator

Design CSS Grid layouts visually. Set rows, columns, gaps, and named areas — get clean, ready-to-use CSS instantly.

Grid Configuration

Live Preview (click a cell to name it as a grid-area)

Generated CSS

How It Works

A CSS Grid is defined by grid-template-columns and grid-template-rows, each a space-separated list of track sizes. The fr unit distributes remaining space proportionally — 1fr 2fr gives the second column twice the width. The gap property sets spacing between tracks without adding outer margin. Named areas (grid-template-areas) let you place items semantically by string row definitions. This generator combines your inputs into the correct CSS syntax and maps each named cell to its grid-area declaration.

FAQ

How do I generate CSS Grid code with this tool?
Set the number of columns and rows, choose track sizes (fr, px, auto, minmax), define the gap, then click Generate. The preview updates live and the tool outputs ready-to-paste CSS with the display, grid-template-columns, grid-template-rows, and gap properties.
What are the best units to use for grid-template-columns?
Use fr for flexible fractions of remaining space, px for fixed widths, auto for content-based sizing, and minmax(min, max) for responsive tracks. Mix units freely — the generator accepts any valid CSS grid track syntax.
Can I define named grid areas visually?
Yes. Click each cell in the preview to assign a name. The generator then produces CSS with grid-template-areas and individual .item-* classes so children align exactly to your named regions.

Related Tools