How to use CSS Flexbox Playground
- Choose a direction and wrapping behavior, or start with a Navigation, Centered or Cards example.
- Set main-axis and cross-axis alignment, gap, item basis, grow and shrink. Change the preview item count to see how a shared sizing rule responds.
- Select Generate Flexbox CSS and copy both rules. Replace .container and .item with your selectors, then test with real content at the intended widths.
Example: CSS Flexbox Playground
Lay out six preview items in wrapping rows with a 16-pixel gap.
Options
- Direction and wrapping
- Direction sets the main axis. row follows the inline axis and column follows the block axis; reverse variants change visual order. Wrap allows another line when items do not fit. Keep a logical source and keyboard order.
- Gap and preview count
- Gap accepts 0 to 96 pixels. The sample count ranges from 3 to 12 and affects only the preview; it is not included as a restriction in the CSS.
- justify-content
- Distributes available space along the main axis. For example, center groups items in the middle and space-between puts free space between them. Switching row to column changes which axis this controls.
- align-items
- Positions items on the cross axis. stretch can expand items across their line, while flex-start, flex-end, center and baseline use the selected alignment. This controls all items rather than an individual align-self override.
- Item sizing
- All sample items share one flex rule. Basis accepts 20 to 400 pixels and supplies the starting main-axis size. Grow and shrink accept 0 to 5 and determine how the items share extra space or shrink when space is short.
Supported inputs and limits
- Three to twelve sample items with one shared sizing rule and bounded numeric settings.
- It does not generate arbitrary per-item rules or your site’s breakpoints.
- Intrinsic text sizes and the available container space affect wrapping.
- Example buttons fill editable layout fields.
- Per-item visual overrides and Tailwind output are not provided.
Where your input is processed
This tool does not upload your inputs. See the limits for anything saved on your device.
Choose alignment for the current axis
The main axis follows flex-direction. Justify-content works along it; align-items works across it. Switching from row to column changes which screen direction those properties control.
Questions about CSS Flexbox Playground
Why do items wrap earlier on my page?
Their content, padding, border and minimum sizes can differ from the sample. The container width also determines the room available.
What does flex-basis set?
It supplies an item’s starting main-axis size before free space is distributed or the items shrink.
Does reverse direction change reading order?
It changes visual order. Keep a logical source order for keyboard and assistive-technology users.