CSS Flexbox Generator

Visually design, experiment, and export responsive CSS Flexbox layouts. Live visual axis overlays, drag & drop reordering, Tailwind utilities, SCSS, React JSX, and preset galleries.

Loading Flexbox Studio Engine...

CSS Flexbox Masterclass & Learning Guide

Understand how main axis, cross axis, justify-content, align-items, and flex sizing work under the hood.

1. Main Axis (justify-content)

The Main Axis is defined by the flex-direction property (e.g., row = horizontal left-to-right, column = vertical top-to-bottom). All justify-content properties distribute items along this main axis.

flex-direction: row → Main Axis is Horizontal
justify-content: flex-start | center | flex-end | space-between | space-around

2. Cross Axis (align-items)

The Cross Axis runs perpendicular to the main axis. Controls like align-items and align-self align items crosswise across the container line.

flex-direction: row → Cross Axis is Vertical
align-items: stretch | flex-start | center | flex-end | baseline

justify-content vs. align-items Summary

PropertyTarget AxisPrimary PurposeCommon Values
justify-contentMain AxisDistribute extra space along item directionspace-between, center, flex-end
align-itemsCross AxisAlign items within a single line vertically/crosswisecenter, stretch, flex-start
align-contentCross Axis (Multi-line)Distribute multi-line flex rows across heightspace-between, stretch, center
align-selfCross Axis (Single Item)Override container align-items for one itemcenter, flex-end, stretch

The Flex Sizing Formula (flex: grow shrink basis)

The flex shorthand syntax sets flex-grow, flex-shrink, and flex-basis simultaneously:

  • flex: 1 (equal grow)flex: 1 1 0% (Items expand equally to consume all remaining space).
  • flex: autoflex: 1 1 auto (Items grow according to content size).
  • flex: noneflex: 0 0 auto (Items remain completely fixed size without growing or shrinking).