←
Design

CSS Grid Generator

Loading the tool…

Ready when you are.Runs in this browser · nothing is uploaded

Drag to build CSS Grid layouts

  • Free
  • No sign-up
  • No upload
  • Works offline

Tool facts

Price
Free, no sign-up, no watermark
Are files uploaded?
No. Everything is processed in this browser, on your device.
Offline use
Works without a connection once this page has loaded
Browser
A recent Chrome, Edge, Firefox or Safari, on computer or phone.

Check it yourself: press F12, open the Network tab, then use the tool. No request carries your data.

About CSS Grid Generator

CSS Grid Generator lets you design a grid layout by drawing it. Set the number of columns and rows, give each track a size such as 1fr, 200px, auto or minmax(100px, 1fr), and adjust the column and row gap. Then press on a cell in the preview and drag across the cells an element should cover: the tool adds a named item spanning exactly those rows and columns. It works with a mouse, a pen or a finger, and there is a manual form for typing row and column numbers.

The output is ready-to-paste CSS for the container and every item plus matching HTML. By default it writes grid-template-areas, so each item gets a readable grid-area name like header or sidebar and empty cells become dots; switch areas off to get grid-column and grid-row line numbers instead. Identical tracks are written as repeat(), and justify-items, align-items, justify-content and align-content are only included when you change them from the default. Items cannot overlap, which keeps the template areas valid.

CSS Grid Generator runs entirely in your browser. Your data is processed on your device and is never uploaded to Qiyi or anyone else.

How to use CSS Grid Generator

  1. Choose a preset or set the number of Columns and Rows under Tracks, then type a size for each track, for example 1fr, auto or 240px.
  2. Press on a cell in the Preview and drag to the last cell the item should cover. Release to create the item.
  3. Rename items in the Items list (the name becomes the CSS class and area name) or remove them with ×.
  4. Adjust Column gap, Row gap and the alignment options, then click Copy CSS or Copy CSS and HTML.

Frequently asked questions

What does fr mean in CSS Grid?

fr is a fraction of the free space in the grid container. With columns 1fr 2fr 1fr the middle column gets half of the space left after gaps and fixed tracks, and each side column a quarter. Use minmax(0, 1fr) instead of 1fr if long words or wide images should not stretch a column.

What is grid-template-areas?

It draws the layout as text: each quoted string is a row and each word names the area a cell belongs to, with a dot for an empty cell. Items are then placed with grid-area: name. Areas must be rectangles and cannot overlap, which is why the generator refuses overlapping items.

How do I make the grid responsive?

Use flexible tracks such as fr, minmax() or percentages, and redefine grid-template-columns and grid-template-areas inside a media query for small screens, for example a single column where every area gets its own row. Copy the CSS twice with different layouts to get both versions.

Can I write repeat() or auto-fill?

Each track box takes one track size, so the count of columns and rows stays visible in the preview. The generator writes repeat() automatically when neighbouring tracks are identical. For auto-fill grids, for example repeat(auto-fill, minmax(200px, 1fr)), edit the copied CSS by hand.

Which browsers support this CSS?

CSS Grid, the gap property, minmax() and grid-template-areas work in all current versions of Chrome, Edge, Firefox and Safari without prefixes. Internet Explorer 11 only supports an older, prefixed Grid syntax.

· Free · Runs in this browser · nothing is uploaded

Drop any file here
Drop it to see which tools can open it