Design

CSS Grid Builder

Define grid-template-columns, grid-template-rows, gap, and alignment — then watch a live preview and copy production-ready CSS. Use presets for common layouts, or type full track lists including minmax() and repeat(). Everything stays in your browser.

Ad placement — top banner
Live preview

Tracks

Leave empty to rely on implicit rows and grid-auto-rows below.

Spacing & flow

Alignment

Presets

CSS output


          
          
        
Ad placement — mid rectangle

What is CSS Grid?

CSS Grid Layout is a two-dimensional system: you define rows and columns at once, then place content into tracks or let the browser auto-place items row by row. It is ideal for page shells, dashboards, card galleries, and any layout where you need both axes to align.

Tracks, gaps, and implicit grid

grid-template-columns and grid-template-rows describe the explicit grid. If you have more items than cells, the browser adds implicit tracks using grid-auto-rows / grid-auto-columns and grid-auto-flow. Leaving rows empty in this tool is a common pattern for “as many rows as needed” with a fixed column template.

Grid vs Flexbox

Use Grid when you need aligned columns and rows in one layout. Use Flexbox for one-dimensional distribution (a single row or column of components). In practice, many sites use Grid for macro layout and Flexbox inside grid cells.

minmax() and fr

fr splits free space after fixed tracks. minmax(min, max) keeps rows or columns from collapsing too small or growing without bound — essential for responsive grids. Combine with repeat() for concise templates.

How to use this tool

  1. Step 1: Edit column and row track lists (or start from a preset).
  2. Step 2: Tune gap, flow, alignment, and how many child items to preview.
  3. Step 3: Copy the CSS and map class names to your markup.

Frequently Asked Questions

Does DroidXP upload my grid?

No. Preview and CSS are generated in your browser only.

Why does my grid-template-rows not show as many rows as I expect?

Explicit rows only create tracks you list. Extra items flow into implicit rows unless you span rows or use grid-auto-rows. Check grid-auto-flow and whether rows are empty in the template.

What does “dense” in grid-auto-flow do?

dense tries to fill holes earlier in the grid when items have different sizes. It can reorder visual flow compared to the DOM — use carefully when tab order and reading order matter.

Can I use this for grid-template-areas?

This builder focuses on track lists. You can add grid-template-areas and named grid-area rules manually in your stylesheet after copying the track and gap CSS.

Why use gap instead of grid gutters?

The gap property (and row-gap / column-gap) is the modern way to space tracks without old grid-gap hacks. It is widely supported in current browsers.

Does subgrid work here?

subgrid is a separate feature for nested grids to align to a parent’s tracks. This tool does not generate subgrid rules — add them when you need nested alignment.

Why do my tracks differ from the design tool?

Browsers resolve fr and minmax() from the container size. Figma and other tools may use different box models or padding — compare in the same viewport and container width.

Should I use Grid for every component?

Not necessarily. Simple toolbars and stacks are often simpler with Flexbox. Use Grid where two-dimensional alignment saves you from nested wrappers and brittle percentages.

Is this a replacement for a design system layout spec?

No. Use it to prototype and learn. Production systems should document breakpoints, spacing tokens, and grid conventions in one place.