๐ŸŽจ CSS ยท GENERATOR

CSS Grid Generator

Build grid layouts visually. Set the columns, rows and gaps, then drag across the preview to draw items. Copy clean CSS with line numbers or named grid-template-areas, the matching HTML, or Tailwind classes.

Draw items ยท Named areas ยท Responsive auto-fill ยท CSS, HTML & Tailwind
Tip: your layout is remembered on this device until you press Reset.Lining things up in one direction only? CSS Flexbox Generator โ†’
Set the tracks, then drag across the preview cells to place items.
Settings

Presets

Columns

Each columne.g. 1fr, 200px, auto, minmax(0, 1fr)

Rows

Row heightgrid-auto-rows, e.g. auto, 120px, minmax(80px, auto)

Container

display
grid-auto-flow
justify-items
align-items
justify-content
align-content

    Items

    Drag across empty cells in the preview to draw a new item. Click an item to edit it.

    Item 1

    Nameclass and area name
    Start 0 = automatic placement (the browser finds the next free cell).
    justify-self
    align-self

    Output

    Class name

    Preview size

    Only changes the preview box. It isn't part of the code.
    Live preview
    Code
    โ—† ABOUT THIS TOOL

    What Is CSS Grid?

    A two-dimensional layout system: rows and columns at the same time.

    display: grid turns an element into a grid container. You define tracks with grid-template-columns and grid-template-rows, and its children (grid items) fill the cells in order, or go exactly where you put them.

    The fr unit shares out the free space: 1fr 2fr gives the second column twice the width of the first. repeat(auto-fill, minmax(160px, 1fr)) fits as many columns as there's room for. That's a responsive card grid with no media queries.

    Items can span several cells using line numbers (grid-column: 1 / 3) or named areas: describe the layout as a little text map with grid-template-areas, then give each item a grid-area name.

    Use Grid for page layouts, dashboards, galleries and forms, anywhere rows and columns need to line up. For a single row or column of items, Flexbox is often simpler.

    ๐Ÿ“ CHEAT SHEET

    Grid Properties at a Glance

    Container properties go on the parent; placement properties go on the items.

    โ–ฅ

    grid-template-columns / rows

    The track sizes, e.g. 200px 1fr, repeat(3, 1fr) or repeat(auto-fill, minmax(160px, 1fr)).

    โ‡ฒ

    grid-auto-rows / flow

    Size of rows created automatically, and whether new items fill rows or columns first (dense back-fills gaps).

    โ†”

    grid-column / grid-row

    1 / 3 runs from line 1 to line 3 (two cells); span 2 takes two cells wherever the item lands.

    A

    grid-template-areas

    A text map such as "header header" "nav main"; items join it with grid-area: header. Use . for an empty cell.

    โŠž

    justify-items / align-items

    Align every item inside its cell: stretch (default), start, center, end. -self does one item.

    โ‡”

    justify-content / align-content

    Move the whole grid inside the container when the tracks don't fill it, e.g. center or space-between.

    โ— THREE STEPS

    How to Use the CSS Grid Generator

    Get your result in under ten seconds.

    1

    Set the tracks

    Choose a fixed number of columns, responsive auto-fill columns, or type your own track list. Do the same for rows.

    2

    Place the items

    Drag across empty cells to draw an item, or set column and row start and span for each item. Name items to get readable areas.

    3

    Copy the code

    Switch between CSS, HTML and Tailwind, turn named areas on or off, and press Copy.

    โœ“ FEATURES

    Why Use the CSS Grid Generator on Developers Web Tools

    Fast, accurate and private โ€” built for developers.

    โœ๏ธ

    Draw on the grid

    Drag across cells to place an item. No need to work out line numbers.

    ๐Ÿ—บ

    Named areas

    Get a readable grid-template-areas map when your layout allows it.

    ๐Ÿ“ฑ

    Responsive columns

    auto-fill / auto-fit with minmax(): columns that adapt without media queries.

    โœ…

    Checked values

    Custom track lists are checked by your browser, so invalid CSS never ends up in your code.

    ๐ŸŒ€

    Tailwind output

    The same layout as Tailwind classes.

    ๐Ÿ”’

    Private

    Runs entirely in your browser. Nothing is uploaded.

    FAQ

    Frequently Asked Questions

    One share of the free space in the grid. 1fr 1fr 1fr makes three equal columns; 2fr 1fr makes the first twice as wide. A 1fr column won't shrink below its content's minimum width; use minmax(0, 1fr) if you need it to.

    Both fit as many columns as there's room for. With few items, auto-fill keeps the empty columns, so items stay their minimum width. auto-fit collapses the empty columns, so items stretch to fill the row.

    Use grid-column: 1 / 3 (from line 1 to line 3) or grid-column: span 2. In this tool, drag across the cells or set the column start and span.

    When every placed item is a rectangle that doesn't overlap another item, and the columns aren't auto-fill/auto-fit (the number of columns must be fixed). The tool tells you when areas aren't possible and uses line numbers instead.

    If any column uses fr, the columns take up all the free space, so there's nothing left to move. It works with fixed sizes like repeat(3, 100px).

    fr rows share out the container's height, so the container needs a height. With an automatic height they behave like auto.

    It uses exact arbitrary values such as grid-cols-[repeat(3,_1fr)], because Tailwind's grid-cols-3 means repeat(3, minmax(0, 1fr)), which isn't quite the same. Items use line numbers (col-[1/3]), even when the CSS uses named areas.

    Only in your own browser (local storage), so it's still there next time. Press Reset to clear it.