CSS Flexbox Playground
Build and learn CSS flexbox layouts visually. Toggle every container and item property and see the result instantly. Copy production-ready CSS output in one click.
.container {
display: flex;
flex-direction: row;
flex-wrap: nowrap;
justify-content: flex-start;
align-items: stretch;
align-content: stretch;
gap: 8px;
}Features
All container props
direction, wrap, justify-content, align-items, align-content, and gap
Per-item controls
flex-grow, flex-shrink, flex-basis, align-self, order, width, height
Dynamic items
Add up to 10 items or remove any selected item
Click to select
Click any item in the preview to jump to its controls
Live preview
See every change reflected instantly in the colored item grid
CSS output
Ready-to-paste CSS for the container and the selected item
How to use
- 1
Open Container tab
Set flex-direction, justify-content, align-items, flex-wrap, and gap for the container.
- 2
Open Items tab
Select an individual item to edit its flex-grow, flex-shrink, width, height, align-self, and order.
- 3
Add or remove items
Click "+ add" to insert items or "remove" to delete the selected one.
- 4
Copy CSS
Click "Copy all" to grab the container and item CSS, ready to paste into your project.
Frequently asked questions
Can I use this to learn flexbox?
Yes. Toggle each property and watch how it affects the layout in real time. The live preview makes it easy to build intuition for justify-content, align-items, and flex-grow without writing any code.
Does the CSS output include all items or just the selected one?
The output includes the full container CSS plus the selected item's CSS (if it has non-default flex properties). To see all items, select each one individually and copy its CSS separately.
What is flex-basis?
flex-basis sets the initial main-axis size of a flex item before grow/shrink are applied. "auto" means the item uses its width or height. Setting an explicit value like "200px" gives the item a fixed starting size that flex-grow and flex-shrink then adjust.
How is align-content different from align-items?
align-content aligns lines of items on the cross axis when flex-wrap creates multiple rows or columns. align-items aligns individual items within their row. align-content has no effect when flex-wrap is nowrap.