← Back to all tools

📦 Flexbox Playground

Experiment with CSS Flexbox visually

10px
5 items

Generated CSS


            
        

About Flexbox Playground

Visually experiment with all CSS Flexbox properties. Change flex-direction, justify-content, align-items, flex-wrap, align-content, and gap in real-time. Add or remove items, see the layout update instantly, and copy the generated CSS code. Perfect for learning Flexbox or quickly prototyping layouts.

How to Use Flexbox Playground

  1. Set the flex container properties: direction, wrap, justify-content, align-items
  2. Add, remove, or resize flex items
  3. Set individual item properties: order, flex-grow, flex-shrink, align-self
  4. Watch the layout update in real time
  5. Copy the generated CSS for container and items

About Flexbox Playground

CSS Flexbox (Flexible Box Layout) is the most important CSS layout system for modern web design. It handles one-dimensional layouts — arranging items in a row or column with precise control over spacing, alignment, and order. Before Flexbox, centering elements vertically required hacky workarounds. Now it's justify-content: center; align-items: center — done. This playground lets you experiment with all Flexbox properties visually: container properties (flex-direction, flex-wrap, justify-content, align-items, align-content, gap) and item properties (order, flex-grow, flex-shrink, flex-basis, align-self). See the effect of every change instantly and copy the resulting CSS.

Frequently Asked Questions

When should I use Flexbox vs Grid?

Flexbox is for one-dimensional layouts (a row OR a column). Grid is for two-dimensional layouts (rows AND columns simultaneously). Use Flexbox for navbars, card rows, form layouts. Use Grid for page layouts, image galleries, dashboards.

How do I center something with Flexbox?

On the container: display: flex; justify-content: center; align-items: center. This centers children both horizontally and vertically — the most common Flexbox use case.

What does flex: 1 mean?

flex: 1 is shorthand for flex-grow: 1; flex-shrink: 1; flex-basis: 0%. It means the item will grow to fill available space equally with other flex: 1 items. Essential for equal-width columns.

What's the difference between justify-content and align-items?

justify-content aligns items along the main axis (horizontal in row direction). align-items aligns along the cross axis (vertical in row direction). Think: justify = main axis, align = cross axis.

How does flex-wrap work?

By default, flex items try to fit on one line. flex-wrap: wrap allows items to flow to the next line when there's not enough space, creating a responsive grid-like behavior without CSS Grid.

Related Tools

Grid Generator → CSS Animation Generator → CSS Unit Converter → CSS Border Generator →