Skip to content
gohacks.dev
Web

CSS Grid Generator

Generate CSS grid layouts: responsive card grids with auto-fill and minmax, fixed column templates, or a page layout with named areas and a mobile fallback.

Free · No sign-up · Your inputs stay in your browser

Input

Build a CSS grid layout

Output

CSS

127 characters

1
2
3
4
5
6
7

repeat(auto-fill, minmax(12rem, 1fr)) is the one-line responsive grid: as many 12rem columns as fit, stretched to fill the row, with no media query. auto-fit instead collapses empty tracks so a few items stretch across the whole row. Named areas let the source order stay logical for screen readers while the visual layout moves.

Runs in this browser. Nothing you paste is sent to a server.

The one-line responsive grid

repeat(auto-fill, minmax(12rem, 1fr)) creates as many 12rem columns as fit and stretches them to fill the row, with no media queries. auto-fit behaves the same but collapses empty tracks, so a few items stretch across the full width. MDN's grid layout guide covers the details.

Named areas

grid-template-areas draws the layout as text, and moving an area is a matter of rewriting the strings in a media query. The HTML can stay in a logical reading order for screen readers while the visual order changes.

Share

Frequently asked questions

What is the difference between auto-fill and auto-fit?
Both create as many tracks as fit. auto-fill keeps empty tracks; auto-fit collapses them so the existing items grow to fill the row.
What does 1fr mean?
One fraction of the free space left after fixed-size tracks are placed. Columns of 1fr 2fr split it one third and two thirds.
Is what I paste sent anywhere?
No. The tool runs entirely in your browser with JavaScript. Nothing you type or paste is sent to our server or stored.

Keep planning

Similar tools