Free tool

Flexbox and grid generator

Lay out a page visually and copy clean CSS.

Runs in your browserNothing is uploadedNo account needed
flex-direction
flex-wrap
justify-content
align-items
Gap (px)
Items
Preview
1
2
3
4
5
6
CSS
.container {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 12px;
}

How to use it

  1. 1

    Switch between Flexbox and Grid.

  2. 2

    Change direction, alignment, gaps and tracks and watch the preview update.

  3. 3

    Copy the CSS for the container and its items.

About this tool

Flexbox arranges items in one direction, and Grid lays them out in rows and columns. Both are powerful, and both have many properties that are easier to understand when you can see them move.

Adjust the controls, see the layout respond and copy only the CSS you need. Everything runs in your browser.