All Tools

CSS Flexbox Generator

Interactively configure a flex container — direction, wrap, alignment — and fine-tune each flex item's grow, shrink, basis, and align-self. See a live preview and copy the generated CSS instantly.

3 items
1
2
3

Click an item to edit its properties below

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

.flex-item-1 {
  flex-grow: 0;
  flex-shrink: 1;
  flex-basis: auto;
}

.flex-item-2 {
  flex-grow: 0;
  flex-shrink: 1;
  flex-basis: auto;
}

.flex-item-3 {
  flex-grow: 0;
  flex-shrink: 1;
  flex-basis: auto;
}
Buy me a coffee

Container properties

flex-direction: Sets the main axis — row, row-reverse, column, or column-reverse.
flex-wrap: Whether items wrap to multiple lines — nowrap, wrap, wrap-reverse.
justify-content: Alignment along the main axis — flex-start, flex-end, center, space-between, space-around, space-evenly.
align-items: Alignment along the cross axis for a single line.
align-content: Alignment of multiple lines (only active when flex-wrap is enabled).

Item properties

flex-grow: How much the item grows relative to siblings when there's extra space.
flex-shrink: How much the item shrinks relative to siblings when space is tight.
flex-basis: The initial size of the item before growing or shrinking.
align-self: Overrides the container's align-items for this specific item.