CSS Flexbox playground
This is a hands-on flexbox playground that generates ready-to-paste display: flex rules. It is for developers learning flexbox or fine-tuning a row or column of items — navbars, button groups, card rows, centred hero content. Change a property, watch the preview rearrange, and copy the exact CSS.
How it works
The playground sets five container properties and writes them out as a display: flex block. flex-direction chooses the main axis (row or column, optionally reversed). justify-content positions items along that main axis; align-items positions them along the cross axis — so swapping the direction swaps which control does what. flex-wrap decides whether items stay on one line or flow onto new lines, and gap sets the spacing between items. The preview is a live flex container using the same values, with the item count adjustable so you can test crowding and wrapping.
Example
With flex-direction: row, justify-content: space-between, align-items: center, flex-wrap: nowrap and gap: 8px, the tool outputs:
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
flex-wrap: nowrap;
gap: 8px;
This is the classic navbar pattern — items pushed to the edges, vertically centred, on a single line.
| justify-content | End gaps | Between items |
|---|---|---|
| flex-start | items packed at start | none |
| center | items packed centre | none |
| space-between | none | equal |
| space-around | half-size | equal |
| space-evenly | equal | equal |
Everything runs in your browser — nothing is uploaded.