๐ŸŽจ CSS & Design

CSS Flexbox Generator

Play with every flex container property and see exactly what it does.

  • Freeno limits, no watermark
  • 0sign-ups or accounts
  • Privateruns on your device
  • Any devicephone, tablet or PC

    

The two axes

Flexbox lays items out along a main axis set by flex-direction (left-to-right for row, top-to-bottom for column). justify-content distributes items along that main axis; align-items positions them on the cross axis. That is why switching to a column layout seems to โ€œswapโ€ the two properties. align-content only matters when items wrap onto several lines โ€” it spaces the lines themselves.

Common recipes

  • Perfect centring: display:flex; justify-content:center; align-items:center.
  • Nav bar with logo left, links right: justify-content: space-between.
  • Equal-width buttons: give children flex: 1.
  • Wrapping tags or chips: flex-wrap: wrap; gap: 8px.

Need rows and columns lined up? That is a job for the CSS Grid Generator.

Frequently asked questions

Why doesnโ€™t align-content do anything?

It only applies when flex-wrap lets items form more than one line.

What is the gap property?

Space between flex items, without margins on the outer edges. Supported in all modern browsers.

What does flex: 1 mean?

Grow to take an equal share of the free space, starting from a size of zero.

Found it useful? Share the Flexbox Generator:

Last updated 2026-11-21 ยท Built by Vinayak Agarwal ยท Part of CSS & Design (37 tools)