guide2 min read

Flexbox Complete Guide

Master CSS Flexbox: alignment, spacing, wrapping, and responsive layouts. Visual examples.

Flexbox is the modern CSS layout system for one-dimensional layouts (rows or columns). Container properties: display: flex activates flex layout. flex-direction sets the main axis (row or column). justify-content aligns items along the main axis (flex-start, center, flex-end, space-between, space-around, space-evenly). align-items aligns items on the cross axis. flex-wrap allows items to wrap to new lines. Item properties: flex-grow controls how items expand, flex-shrink controls how they contract, and flex-basis sets the initial size. The shorthand flex: 1 is equivalent to flex-grow: 1; flex-shrink: 1; flex-basis: 0%.