← All Tools

CSS Flexbox Playground Formatter🔒 100% local

Experiment with flexbox properties. Privacy-first, no server uploads, no tracking.

Related Tools

Border Radius PreviewBox Shadow GeneratorCode Heatmap

Takes the container settings as free-order space-separated tokens plus an optional item: section, and prints the .container and .item rules with the flex shorthand, the mental model, and notes that apply to that exact combination. Because center, flex-start and flex-end are legal on both axes, the first one you write fills justify-content and the second fills align-items, so 'center center' behaves the way people mean it. Press Process with an empty box and it prints the format sheet instead of an error.

How to use it

  1. Type the tokens in any order, for example row wrap center center 16px.
  2. Add item settings after the word item: - for example item: grow 1 basis 240px - to get the .item rule and its one-line shorthand.
  3. Read the Gotchas section when it appears; the notes are chosen from your direction, wrap, align and item values.
  4. Copy Output takes the rules, the reading guide and the notes.

Worked example

row wrap center center 16pxbecomes.container { display: flex; flex-direction: row; flex-wrap: wrap; justify-content: center; /* main axis (horizontal) */ align-items: center; /* cross axis (vertical) */ gap: 16px; }

A bare number for the gap becomes px; px, rem, em, % and ch are also accepted.

row nowrap center center 12px item: grow 1 basis 240pxbecomes.item { flex-grow: 1; flex-basis: 240px; } /* The same item in one line: */ .item { flex: 1 1 240px; }

The shorthand line is added whenever grow, shrink or basis was given; the container block above it is unchanged.

row, center, centerbecomesUnrecognised container value: "row,". Valid: direction, wrap, justify-content, align-items, gap.

Commas are not separators here. This is the format of the generator next door, and pasting it into the playground fails on the first token.

When to use it

What it does not do