Build CSS Grid layouts without guesswork
CSS Grid controls rows and columns together, making it ideal for dashboards, galleries, application shells and editorial layouts. This generator lets you test track sizing and alignment visually before moving the result into your project.
Combine fr, fixed lengths, percentages, auto, minmax() and repeat().
Align items inside their grid areas or position the entire grid when spare container space exists.
Your layout is generated in the browser. No CSS or project content is uploaded.
How to use the CSS Grid Generator
- Define column and row tracks using valid CSS sizing values.
- Choose gaps, item alignment and the auto-placement direction.
- Apply a preset for common layouts or refine every setting manually.
- Copy or download the generated CSS, and use the HTML tab for starter markup.
Useful track patterns
repeat(3, 1fr) creates three equal columns. minmax(220px, 1fr) prevents a track becoming too narrow. For an automatically wrapping card grid, try repeat(auto-fit, minmax(220px, 1fr)) as a single column-track definition.
Frequently Asked Questions
What does the fr unit mean?
An fr unit receives a fraction of the available grid space after fixed tracks and gaps have been accounted for.
What is the difference between justify-items and justify-content?
justify-items aligns content inside each grid area. justify-content positions the complete grid inside its container when the tracks do not consume all available width.
When should I use dense auto-flow?
Dense packing can fill earlier gaps with later items, but it may change the visual order. Avoid it when visual and reading order must remain identical.
Is the generated Grid responsive?
Fractional and minmax() tracks adapt naturally. For a fully responsive card grid, use auto-fit or auto-fill with minmax() and test the result at your project breakpoints.