CSS Grid Builder

Build CSS grid layouts: column and row sizes, gaps, and items that span cells. Live preview with CSS and HTML to copy.

Runs in your browserNo sign-upWorks offline
#38E1CF → #5B8CFF
#F472B6 → #FBBF24
#22C55E → #0EA5E9
background: linear-gradient(135deg, #38E1CF, #5B8CFF);

What the CSS Grid Builder does

The CSS Grid Builder lays out a page or component with CSS grid. Set the size of each column and row with fr, px, %, auto or minmax(), choose the gaps, and place items by their starting column and row and how many they span. The preview shows the grid lines and the items, and the tool writes the CSS for the container and each item, plus matching HTML.

How to use it

  1. Set the columns and rows; use + and − to add or remove them.
  2. Set the column and row gaps.
  3. Name each item and set its column, row and spans in the table.
  4. Copy the CSS and HTML.

Example

The starting layout is a classic page: columns 1fr 2fr 1fr, rows 80px 160px 80px, a header spanning all three columns, a sidebar in the first column and the main area spanning two columns, with a footer underneath. Changing the first column to minmax(120px, 1fr) keeps the sidebar at least 120 px wide on small screens.

Track sizes

fr shares out the free space: 1fr 2fr 1fr gives the middle column twice the width of each side. auto fits the content, px fixes a size, and minmax(200px, 1fr) sets a minimum and a maximum. For a responsive card grid without media queries, use repeat(auto-fill, minmax(200px, 1fr)) as the columns.

Items that share cells overlap, and the later item is drawn on top. That is useful for putting text over an image without absolute positioning.

Questions people ask

Is anything uploaded?

No. Everything is worked out in your browser, so your colours, designs and images stay on your device.

Grid or flexbox?

Grid places items in rows and columns at once, good for page layouts. Flexbox lines items up in one direction, good for toolbars and menus.

Does CSS grid work everywhere?

Yes. Every current browser supports it, including on phones.

Why is a track size marked red?

It is not a size the builder understands. Use values such as 1fr, 200px, auto or minmax(200px, 1fr).

Related tools