Flexbox & Grid Playground.
Experiment with flexbox and CSS grid container properties on live boxes and copy the CSS or Tailwind classes.
Runs in your browserDrag the bottom-right corner of the preview to resize the container.
About Flexbox & Grid Playground
The Flexbox & Grid Playground is a sandbox for the container properties that control CSS layout. Pick flexbox or grid, change a property, and the numbered boxes in the preview rearrange instantly, which makes the difference between justify-content and align-items, or between align-items and align-content, obvious in a way documentation rarely does. In flex mode you can set flex-direction, flex-wrap, justify-content, align-items and align-content; in grid mode you type grid-template-columns and grid-template-rows track lists such as repeat(auto-fill, minmax(120px, 1fr)) or 200px 1fr, and choose grid-auto-flow and justify-items. The gap and the number of items are adjustable, and items have different heights so alignment has a visible effect. The output contains only the declarations that differ from the defaults, the equivalent Tailwind classes such as flex flex-wrap justify-between items-center gap-3, and an HTML snippet. For example, a wrapping row with space-between and center alignment is the classic toolbar layout. Common confusions it clears up are that align-content does nothing without wrapping, that justify-content runs along the main axis so it turns vertical with flex-direction: column, and that grid uses start and end rather than flex-start and flex-end. The page works entirely in your browser.
How to Use
- Choose flex or grid and change the container properties.
- Watch the numbered boxes in the preview rearrange.
- Copy the CSS, the Tailwind classes or the HTML snippet.
Frequently Asked Questions
What is the difference between justify-content and align-items?
justify-content distributes items along the main axis (horizontal for rows), align-items positions them on the cross axis. With flex-direction column the two axes swap.
Why does align-content have no effect?
It only distributes multiple lines. In flexbox you need flex-wrap enabled and enough items to wrap.
When should I use grid instead of flexbox?
Use grid when you control both rows and columns (page layouts, card grids); use flexbox for one-dimensional rows or columns such as toolbars and button groups.
Is anything uploaded?
No. The playground runs in your browser.
Related Tools
Calculate and compare CSS selector specificity, including :is(), :not(), :has(), :where() and nth-child(of S).
Set each corner radius, including elliptical corners, and copy the shortest CSS or Tailwind classes.
Design soft, layered or inset CSS box-shadows with a live preview and Tailwind output.
See your live viewport size, screen resolution, pixel ratio, active CSS breakpoints and media features.
Drag polygon points or pick a preset shape and copy the CSS clip-path for images and sections.
Check text and UI color contrast against WCAG 2.2 AA and AAA, with the closest passing colors.