๐ŸŽจ CSS Tools

Flexbox Playground

Experiment with every CSS Flexbox property in real time. Click items to control individual flex properties.

Container Properties
flex-direction
flex-wrap
justify-content
align-items
align-content
gap
Item Properties (click item to select)
Live Preview (click items to select)
โœ“ Copied!

Related CSS Tools

Frequently Asked Questions

What is CSS Flexbox?

Flexbox (Flexible Box Layout) is a CSS layout model that allows elements inside a container to be automatically arranged, aligned, and distributed along one axis (row or column). It's ideal for 1-dimensional layouts โ€” navigation bars, card rows, centred content โ€” and is now supported in all modern browsers.

What is the difference between justify-content and align-items?

justify-content controls alignment along the main axis (the direction flex items flow). align-items controls alignment along the cross axis (perpendicular to the main axis). When flex-direction is row, justify-content is horizontal and align-items is vertical โ€” and vice versa when column.

When should I use Flexbox vs CSS Grid?

Use Flexbox for 1-dimensional layouts where items flow in a single direction (e.g. navigation bars, toolbars, centred content). Use CSS Grid for 2-dimensional layouts where you need to control both rows and columns simultaneously (e.g. page layouts, card grids, dashboards).

What does flex: 1 mean?

flex: 1 is shorthand for flex-grow: 1; flex-shrink: 1; flex-basis: 0%. It tells an item to grow and shrink proportionally to fill available space. Multiple items each with flex: 1 will share the container space equally.