Flexbox Grid Playground
Tweak flexbox visually and copy the CSS.
How to use
- 1 Choose flex-direction, flex-wrap, justify-content, align-items and align-content from the dropdowns.
- 2 Drag the gap slider to set the spacing between items.
- 3 Add or remove preview items to test different content amounts.
- 4 Copy the generated .container CSS into your stylesheet.
About Flexbox Grid Playground
The Flexbox Grid Playground lets you learn and tune CSS flexbox by eye instead of by trial and error in your editor.
Flexbox is the workhorse of modern layout — it powers navbars, card rows, button groups and centred hero sections — but remembering exactly what justify-content, align-items and align-content each do is genuinely hard.
This playground turns every property into a dropdown or slider and shows the effect on a row of preview items the instant you change it.
Pick a flex-direction to flow items across rows or down columns, switch flex-wrap to let them spill onto new lines, and use justify-content and align-items to position them along the main and cross axes.
When wrapping is on, align-content controls the spacing between the wrapped lines.
A gap slider sets the spacing between items in pixels, and you can add or remove preview boxes to see how the container responds to different amounts of content.
As you experiment, the tool writes a clean, copy-ready .container rule that you can paste straight into your stylesheet.
Every keyword is validated, so the generated CSS is always valid, and the whole thing runs locally in your browser with nothing uploaded.
It is equally useful as a teaching aid for people learning flexbox and as a quick scratchpad for experienced developers nailing down a tricky layout.
FAQ
What is the difference between align-items and align-content?
align-items positions items along the cross axis within a single line, while align-content distributes the space between multiple wrapped lines. align-content only has an effect when items wrap onto more than one line.
Why does justify-content not seem to do anything?
justify-content needs free space along the main axis. If your items already fill the row, or the gap and item sizes leave no slack, there is nothing for it to distribute.
Is the generated CSS production-ready?
Yes. The tool only ever emits valid flexbox keywords and a pixel gap, so you can paste the .container rule directly into your stylesheet.