Skip to content
Jellykit

Flexbox Playground

Try every flexbox container and item property on live boxes, see the layout change at once and copy the CSS and HTML.

  • Runs on your device
Loading tool

About Flexbox Playground

Flexbox is easiest to understand by changing one property and watching what moves. Set the direction, wrapping, justify-content, align-items, align-content and gap of a container, and the boxes inside rearrange as you go.

Tap any box to give it its own grow, shrink, basis, order or align-self, the settings that trip people up most often. The CSS is written as you work, with an nth-child rule for each box you changed, and the whole setup is kept in the page address so you can share exactly what you see.

How it works

  1. The preview is a real flex container drawn by your browser, so what you see is what the CSS does.
  2. Container settings apply to the whole row or column; align-content appears only when wrapping is on, because it moves wrapped lines and does nothing to a single line.
  3. Item settings are stored per box. Grow, shrink and basis are written together as the flex shorthand; order and align-self are written only when they differ from the defaults.
  4. Boxes in the preview have different sizes on purpose, so you can see alignment along both axes.

Questions

Why do the boxes in the preview have different sizes?

With identical boxes, align-items and align-self would look like they do nothing. The sizes are only for the preview; the CSS sets flex properties and nothing else.

What values can flex-basis take here?

auto, content, 0, or a length in px, em, rem, %, vw, vh, ch, ex, cm, mm, in, pt or pc. A value the tool cannot read is marked and the last good one stays in use.

How many items can I add?

From 1 to 12, enough to see wrapping and space distribution clearly. Settings you give an item are kept if you lower the count and raise it again.

Is anything saved or sent?

No. The layout lives in the page address and in this tab only, so a copied link reopens it, and nothing leaves your device.

Everything you enter here is processed in this browser tab. Nothing is uploaded, logged or shared. How privacy works here.