Flexbox Playground
Experiment with every CSS Flexbox property and see the effect live. 100% client-side.
.container {
display: flex;
flex-direction: row;
flex-wrap: nowrap;
justify-content: flex-start;
align-items: stretch;
align-content: flex-start;
gap: 12px;
}.item-a {
width: 100px;
height: 80px;
flex-grow: 0;
flex-shrink: 1;
flex-basis: auto;
align-self: auto;
order: 0;
}Container
Items (4/8)
📖 Flexbox property reference
About Flexbox Playground
CSS Flexbox (Flexible Box Layout) is a one-dimensional layout model for arranging items in a row or column. It solves alignment and distribution problems that were difficult with floats and inline-block. Flexbox has two axes: the main axis (set by flex-direction) and the cross axis. Container properties (justify-content, align-items, align-content, gap) control all children; item properties (flex-grow, flex-shrink, flex-basis, align-self, order) control individual children. Learning flexbox is easier with a visual playground: change a value, see the immediate effect, and build intuition. This tool gives you every property with sliders and dropdowns, configurable items, and a live preview.
How It Works
- Set the container properties: display, flex-direction, flex-wrap, justify-content, align-items, align-content, gap.
- Add or remove child items (up to 8).
- For each item, configure width/height, flex-grow, flex-shrink, flex-basis, align-self, order.
- See the layout update live as you change values.
- Copy the generated CSS.
✨ Key Features
- ✓All flex container properties
- ✓All flex item properties
- ✓Live preview with adjustable items
- ✓1–8 configurable child items
- ✓Visual item editor
- ✓Adjustable container size
- ✓Toggle outlines for item visibility
- ✓Copy container CSS and item CSS
- ✓Property reference with descriptions
- ✓Preset layouts (nav bar, centered card, grid-like)
- ✓100% client-side — no data sent to any server
🎯 Common Use Cases
- →Learning flexbox by experimenting
- →Prototyping a layout before coding
- →Debugging flexbox alignment issues
- →Generating CSS for a specific layout
- →Teaching flexbox in a classroom or workshop
- →Understanding justify-content vs align-items
- →Testing responsive layouts
- →Comparing gap vs margin-based layouts
💡 Advanced Tips & Pro Insights
- ▸flex-direction changes the MAIN axis. If direction is "row", justify-content aligns horizontally, and align-items aligns vertically. If direction is "column", they swap.
- ▸justify-content distributes items along the main axis. align-items aligns them along the cross axis.
- ▸align-content only works when flex-wrap is set AND items wrap to multiple lines. With one line, it has no effect.
- ▸flex-grow controls how much an item grows when there is extra space. flex-shrink controls how much it shrinks when there is not enough space. flex-basis is the initial size.
- ▸The shorthand flex: 1 means flex: 1 1 0% (grow, shrink, basis). flex: auto means 1 1 auto. flex: none means 0 0 auto.
- ▸gap is the modern way to add space between items — simpler than margins and no negative margin tricks.
- ▸align-self overrides align-items for a single item — useful for one-off alignments.