BUILD, INSPECT AND REUSE

CSS Flexbox Playground

Explore how direction, wrapping, alignment and item sizing work together. Try practical layouts, resize the preview and export CSS or a standalone demo.

Main & cross axis controlsGrow / shrink / basisCSS, HTML demo & project JSON

1. Adjust the container

2. Adjust the items

3. Inspect the result

Restore layout settings

Wrapped-line alignment matters when wrapping creates multiple lines and cross-axis space is available. Items share the same flex settings; this version does not configure individual order or align-self. Reverse directions change visual order while DOM and keyboard order stay unchanged. Rename exported classes to fit your project.

Using CSS Flexbox Playground

Inspect one-dimensional layout rules with fixed preview width and container height. The generated CSS matches the container and uniform item settings.

  1. Choose direction, wrapping, alignment, gap and container height.
  2. Tune item count, flex basis, grow and shrink, then vary the preview width or try a preset.
  3. Copy CSS, download the demo or save/import project JSON.

Example

Wrapping cards: row, wrap, basis 180px, grow 1.
Decrease preview width to produce more lines. Grow distributes remaining space among items on each line.

Questions & answers

What are the main and cross axes?

Row directions have a horizontal main axis and vertical cross axis. Column directions swap these. Justify-content acts along the main axis; align-items acts across it.

Why does align-content sometimes do nothing?

It distributes wrapped lines when wrapping creates multiple lines and the container has cross-axis space. It does not align individual items in a single nowrap line.

Why can grow change justify-content results?

Flex-grow can consume the available space before justify-content distributes leftover space. Set grow to zero when exploring space-between or centering fixed-size items.

Does reverse direction change keyboard order?

No. Row-reverse and column-reverse change visual placement but retain DOM order. Review accessibility and reading order before using reversed layouts.

Can I style individual items?

This version applies the same flex values to every item and does not set individual order or align-self. Preview font sizes vary to make baseline alignment visible; the downloaded demo includes that decoration.

What can I save?

Copy CSS, download a standalone HTML demo or save a JSON project. Up to 20 items are supported, and JSON imports are limited to 16 KiB. Nothing is automatically stored.

Help improve this tool

Report a problem or suggest an improvement

Describe the issue without pasting private tool input. Feedback goes to our admin inbox.

Find another tool · Read practical guides