CSS Grid Playground
Design two screen configurations. Replace .your-grid with your project selector and check the result with your real content widths.
1. Basic settings
Edit tracks and named areas.
2. Rows and columns by screen
Up to eight tracks per axis. px is fixed, fr shares leftover space, and minmax uses a px minimum and fr maximum.
Wide screen
Columns
Rows
Narrow screen
Columns
Rows
3. Named areas
Area names start with a lowercase ASCII letter and may include digits or hyphens. Set starting positions and spans for each screen.
i2 · aside
i3 · main
i4 · footer
4. Preview and checks
Preview switches the wide and narrow rules directly. Scroll horizontally to inspect the wide layout on a phone.
5. HTML and CSS
HTML labels are escaped text. Adjust selectors, colors, and spacing for your site.
CSS
.your-grid {
display: grid;
gap: 12px;
grid-template-columns: minmax(150px, 1fr) minmax(0px, 2fr);
grid-template-rows: 76px 160px 70px;
grid-template-areas:
"header header"
"aside main"
"footer footer";
}
.your-grid > .area-header { grid-area: header; }
.your-grid > .area-aside { grid-area: aside; }
.your-grid > .area-main { grid-area: main; }
.your-grid > .area-footer { grid-area: footer; }
@media (max-width: 640px) {
.your-grid {
grid-template-columns: 1fr;
grid-template-rows: 70px 90px 150px 65px;
grid-template-areas:
"header"
"aside"
"main"
"footer";
}
}HTML
<div class="your-grid">
<div class="area-header">Header</div>
<div class="area-aside">Aside</div>
<div class="area-main">Main</div>
<div class="area-footer">Footer</div>
</div>CSS Grid Playground
Choose fixed px, fractional fr, or minimum-width minmax tracks for each row and column. Place labeled items in named rectangular areas. Edit the wide layout and the narrow layout below your breakpoint separately, then switch the live previews. Overlaps and placements outside the tracks are reported and block export. A valid design produces grid-template-areas, a responsive media query, and matching HTML.
Key features
- Independent wide and narrow row/column tracks
- px, fr, and minmax(px,fr) tracks
- Direct editing of named area placement and spans
- Overlap and out-of-bounds checks with both previews
- Copy/download grid-template-areas HTML and CSS
How to use
- Start with the example and adjust the breakpoint and gap.
- Add or edit row and column tracks for the wide and narrow layouts.
- Give each item an area name and its starting row/column and spans in each layout.
- Switch previews and resolve overlap or bounds issues.
- Copy or download HTML and CSS after validation passes.
Use cases
- Prototype header, sidebar, content, and footer
- Compare minmax and fr sizing
- Review mobile reflow and area conflicts
Frequently asked questions
Can minmax and fr tracks be mixed?
Yes. Each track can be fixed px, fractional fr, or minmax with a px minimum and fr maximum. This editor generates that restricted syntax.
What happens when areas overlap?
If two items use the same cell or an item extends beyond configured tracks, the issue is shown and HTML/CSS exports are disabled.
How is the narrow layout exported?
An @media(max-width) rule below your breakpoint applies the separate narrow rows, columns, and named areas. The preview switches configurations directly.
Can I paste arbitrary CSS?
No. This is a structured editor with a fixed set of grid properties and track bounds. You can extend the downloaded code in another editor.
Is the layout autosaved?
No. It remains in this page's memory. Download HTML and CSS to keep the output.
Privacy
The layout stays in the current browser memory and is not sent to this tool's server API. Downloaded HTML/CSS includes your area names and labels.
Comments & questions