CSS Flexbox Playground

Learn and copy flexbox layout code visually.

Runs in your browser Color & CSS Free · No account

Input

12
Processed locally

This tool runs entirely in your browser. The data you paste or load is never uploaded.

Result

Enter your input, then run the tool.

About this tool

Adjust direction, wrapping, alignment, gap and child flex values, then copy the CSS for the container and children. A live preview with numbered items makes the alignment behaviour obvious.

How to use it

  1. Set the flex direction and wrapping.
  2. Change justify-content, align-items and gap to see the effect.
  3. Copy the generated container and item CSS.

Frequently asked questions

What does align-content affect?
It distributes space between wrapped lines, so it only has an effect when flex-wrap is enabled and there is more than one line.
Why is gap better than margins?
Gap spaces items without affecting their outer edges and without extra wrapper selectors.

Keep going

More in this category