DevKits

CSS Grid Generator — Visual Layout Builder with Live Preview

Interactive CSS Grid playground. Configure grid-template-columns / rows with fr / px / auto tracks, gap, and per-item span. Live preview + copy-ready CSS and Tailwind classes. 100% local.

Last updated:

Comments
Columns (3)
1
2
3
Rows (2)
1
2
Gaps
Selected item · #1
CSS
.container {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  grid-template-rows: 80px 80px;
  column-gap: 12px;
  row-gap: 12px;
}
Tailwind (container)
grid grid-cols-3 grid-rows-[80px_80px] gap-3

Frequently Asked Questions

What is the fr unit?

fr stands for 'fraction of the free space'. When you write grid-template-columns: 1fr 2fr, the second column gets twice as much of the remaining space as the first (after any fixed-size tracks are laid out). Unlike percentages, fr accounts for gaps automatically. It's the go-to unit for flexible grid layouts.

When should I use grid instead of flexbox?

Grid is a two-dimensional layout system: you define rows and columns simultaneously and can place items into cells. Flexbox is one-dimensional. Use grid for anything that has a real 2D structure — dashboards, card galleries, magazine layouts, whole-page templates. Use flexbox for aligning a row or column of items.

How do I make an item span multiple columns or rows?

Set grid-column: span 2 (or span N) to make an item take N columns starting from the auto-placed position. To place it at a specific column, use grid-column: 2 / span 2 (start at line 2, span 2 tracks). Same syntax for grid-row. This tool exposes those directly in the item panel.

What are min-content and max-content?

min-content sizes the track to the largest unbreakable chunk of content inside it (usually the longest word). max-content sizes it to the widest the content wants to be if it never wrapped. Useful for text-driven columns where you don't want awkward mid-word breaks or unnecessarily wide columns.

Are the generated Tailwind classes production-ready?

Yes. When you use equal 1fr columns, the tool emits shortcuts like grid-cols-3. Custom track sizes fall back to arbitrary-value syntax like grid-cols-[200px_1fr_100px]. Both forms are valid Tailwind v3+ classes.

Related Tools