Flexbox Generator

Common patterns
Live preview
1
2
3
4
CSS
.container {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  justify-content: flex-start;
  align-items: stretch;
  align-content: stretch;
  gap: 8px;
}

Flexbox has six container properties, each with its own set of values, and the spec's defaults rarely match what you actually want. The Flexbox Generator gives you the playground: pick a flex-direction, pick a wrap mode, pick a justify-content and align-items, drag the gap slider, and watch a row of preview items react. When the layout looks right, copy the CSS rule for the container and paste it into your stylesheet. Common patterns — centered, space-between, sidebar + content, wrap grid, footer bar — are one click away, so you don't have to remember which property does what.

Built by Bob QA by Ben Shipped

How to use

  1. 1

    Click a preset (Centered, Space between, Sidebar + content, Wrap grid, etc.) to load a common pattern, or start from scratch with the dropdowns.

  2. 2

    Change flex-direction (row, column, and the -reverse variants) to set the main axis.

  3. 3

    Pick flex-wrap (nowrap, wrap, wrap-reverse) — only items with wrap can spill onto new lines.

  4. 4

    Pick justify-content to position items along the main axis: flex-start, center, space-between, space-around, space-evenly.

  5. 5

    Pick align-items to position items along the cross axis: stretch, center, baseline, flex-start, flex-end.

  6. 6

    Drag the gap slider for the space between items. Add or remove preview items with the +/- buttons to see how the rules behave with different counts.

  7. 7

    Copy the generated CSS. Paste it onto your container. Your child items inherit nothing — they just get laid out by the parent's rules.

Frequently asked questions

Ratings & Reviews

Rate this tool

Sign in to rate and review this tool.

Loading reviews…