CSS Grid Generator
Build a CSS Grid layout visually: tune columns, rows, gaps and alignment, span items, switch to responsive auto-fit and copy production-ready code.
Visual builderItem spanningResponsive auto-fitCopy CSS + HTML
Live preview
Tap an item to span itItem 1
CSS
HTML
Why use this tool
Click to span
Select any item and stretch it across columns and rows to build real layouts.
Truly responsive
Switch to auto-fit and minmax so columns reflow with no media queries.
Clean code
Copy tidy CSS and matching HTML with semantic class names.
How it works
- Set columns, rows and gaps, or switch to responsive auto-fit.
- Tap items in the preview to span multiple cells.
- Copy the generated CSS and HTML into your project.
Frequently asked questions
What is CSS Grid?
CSS Grid is a two-dimensional layout system that places items into rows and columns. It is ideal for page layouts, galleries and dashboards.
What does 1fr mean?
One fraction of the available space. repeat(3, 1fr) makes three equal columns that share the width.
How does auto-fit minmax make a grid responsive?
repeat(auto-fit, minmax(160px, 1fr)) fits as many columns of at least 160px as the container allows and stretches them to fill the row, so no media queries are needed.
When should I use Grid instead of Flexbox?
Use Grid when you need to control rows and columns together. Use Flexbox for a single row or column of items, such as a navigation bar.
Do all browsers support CSS Grid?
Yes. CSS Grid is supported in all modern browsers, including Chrome, Firefox, Safari and Edge.