CSS Flexbox Generator

Build CSS Flexbox layouts visually. Adjust direction, alignment, wrapping, and gap with a live preview.

Preview

1
2
3
4

CSS

.container {
  display: flex;
  flex-direction: row;
  justify-content: flex-start;
  align-items: stretch;
  flex-wrap: nowrap;
  gap: 10px;
}

Frequently Asked Questions

What is CSS Flexbox?+
Flexbox (Flexible Box Layout) is a CSS layout model that distributes space and aligns items in a container. It's ideal for one-dimensional layouts — laying out items in a row or column.
When should I use Flexbox vs Grid?+
Use Flexbox for one-dimensional layouts (a row or column of items). Use CSS Grid for two-dimensional layouts (rows AND columns). Flexbox is better for navigation bars, card rows, and centering. Grid is better for full page layouts and complex grids.
What does flex-grow do?+
flex-grow determines how much an item grows relative to its siblings. A value of 0 means it won't grow. A value of 1 means it takes its proportional share of available space. A value of 2 means it takes twice as much space as items with flex-grow: 1.

Related Tools

CSS Flexbox Generator — free online css flexbox, flexbox generator, flex layout, css flex, flexbox playground. No signup required. Works in your browser.