Skip to content

Menu

Flexbox Playground

Visual flexbox editor with live preview, child item controls, and CSS output.

Runs entirely in your browserDesignFree, no sign-up
Loading tool

01What is Flexbox Playground?

Flexbox makes sense once you watch it move. Reading that justify-content works on the main axis is one thing. Seeing three boxes jump to the bottom when you switch flex-direction to column is another. Flexbox Playground is a live flex container you can poke at, with the CSS written out as you go. The container controls sit above the preview. Direction offers row, row-reverse, column and column-reverse. Wrap offers nowrap, wrap and wrap-reverse. Justify runs from flex-start to space-evenly, Align covers stretch, flex-start, flex-end, center and baseline, and Gap sets the space in pixels. These map one to one onto the properties in the W3C CSS Flexible Box Layout spec, so nothing is simulated. The preview is a real flex box and your browser lays it out. You start with three numbered items. Add Item appends another, and the trash icon removes one, though the last item always stays. Click an item in the preview or in the Items list to open its settings: Grow, Shrink, Basis, Order and Align Self. Basis is a text field, so you can type 200px, 30% or 10rem. The CSS Output keeps things short. The .container rule always lists all five properties. A .item-N rule shows up only for items you changed from the defaults of grow 0, shrink 1, basis auto, order 0 and align-self auto. Set Justify to space-between, Align to center and give item 2 a Grow of 1. You get the container rule plus .item-2 with flex-grow: 1. Item 2 eats the free space, so space-between has nothing left to share out. That is a classic header layout with a stretchy middle. Some limits to keep in mind. align-content and the flex shorthand are not exposed, so add them by hand if you need them. Item rules are numbered by position, so deleting item 1 renames the others. If you clear the Basis field instead of typing auto, the output shows an empty flex-basis line, which browsers ignore. The Gap box is not clamped either, so a negative number gives invalid CSS. Your layout lives only in this tab and is gone on reload, so copy the CSS before you leave.

Front-end developers who want to test flex container and item settings visually and copy only the CSS that differs from the defaults. The tool runs entirely in your browser, so your data never leaves your device.

02How to use Flexbox Playground

  1. Set Direction, Wrap, Justify, Align and Gap in the controls above the preview
  2. Click Add Item to add boxes, or the trash icon to remove one
  3. Click an item in the preview or the Items list to open its settings
  4. Change Grow, Shrink, Basis, Order or Align Self and watch the preview update
  5. Click Copy in the CSS Output panel, or Reset to start again

03Worked examples

Input: Defaults: Direction row, Wrap nowrap, Justify flex-start, Align stretch, Gap 8, three items untouched
Result: .container { display: flex; flex-direction: row; flex-wrap: nowrap; justify-content: flex-start; align-items: stretch; gap: 8px; }
Container properties are always written out even when they match the browser defaults. Item rules appear only when an item is changed.
Input: Justify space-between, Align center, Item 2 Grow 1
Result: .container { display: flex; flex-direction: row; flex-wrap: nowrap; justify-content: space-between; align-items: center; gap: 8px; } .item-2 { flex-grow: 1; }
Item 2 grows to fill the free space, so space-between has nothing left to distribute.
Input: Wrap wrap, Gap 16, each item Basis 200px
Result: .item-1 { flex-basis: 200px; } .item-2 { flex-basis: 200px; } .item-3 { flex-basis: 200px; }
Trimmed to the item rules. The container rule shows flex-wrap: wrap and gap: 16px.
Input: Direction column, Item 2 Order -1, Item 3 Shrink 0 and Align Self flex-end
Result: .item-2 { order: -1; } .item-3 { flex-shrink: 0; align-self: flex-end; }
Trimmed to the item rules. Order -1 moves item 2 to the top visually while it stays second in the HTML and tab order.
Input: Item 1 Basis field cleared to empty
Result: .item-1 { flex-basis: ; }
An empty Basis is treated as changed, so a blank declaration is written. Browsers ignore it. Type auto instead.

04Common use cases

  • Building a header with a logo on the left, links on the right and a growing spacer in the middle
  • Finding out why a sidebar shrinks when the main column has wide content, by setting its Shrink to 0
  • Prototyping a wrapping row of cards with a 200px basis before writing media queries
  • Reordering one item visually with order while checking that the source order stays the same
  • Comparing space-between, space-around and space-evenly side by side on the same items
  • Teaching the difference between justify-content and align-items by switching Direction to column

05Tips

  • Order changes only the visual position. Screen readers and the Tab key still follow the HTML order, so do not use it to fix content order.
  • In a column layout, justify-content moves items vertically and align-items moves them horizontally. The axes swap with Direction.
  • Type auto rather than clearing the Basis box. An empty Basis writes a blank flex-basis line that browsers throw away.
  • Shrink defaults to 1, so items get squeezed when space runs out. Set it to 0 on things like logos and icons that must keep their size.
  • baseline alignment lines up the first line of text in each item, which looks neater than center when items have different font sizes.

06Related concepts

flex-direction, justify-content, align-items, flex-basis, flex-grow, order.

Frequently Asked Questions

What is Flexbox Playground?

Flexbox Playground is a free, browser-based developer tool on AIDToolStack. Visual flexbox editor with live preview, child item controls, and CSS output. It requires no installation or sign-up and works entirely in your browser.

Is Flexbox Playground free to use?

Yes. No sign-up, no fees and no usage cap.

Does Flexbox Playground store my data?

No. It runs in your browser; nothing is uploaded.

Cheat sheet

Related Tools

Reviews and commentsShow

Reviews

Sign in to leave a review.

Loading reviews…

Comments

Sign in to leave a comment.

Loading comments…

What changed in AI dev tools, once a month

Renames, shutdowns, pricing changes and new MCP setups, each with a source.

Subscribe