CSS Flexbox Playground

Experiment with flexbox properties and copy the CSS.

Ad placeholder (leaderboard)
Enjoying the tools? Go Pro for £4.99 (one-time) and remove all ads — forever, on this device. Remove ads — £4.99

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-contentEnd gapsBetween items
flex-startitems packed at startnone
centeritems packed centrenone
space-betweennoneequal
space-aroundhalf-sizeequal
space-evenlyequalequal

Everything runs in your browser — nothing is uploaded.

Ad placeholder (rectangle)