Tools

Flexbox Cheatsheet

Complete reference for all CSS Flexbox properties: container properties (flex-direction, justify-content, align-items, etc.) and item properties (flex-grow, order, align-self, etc.) — with all values and use cases.

flex-directioncontainer

Sets the direction of the main axis along which flex items are placed.

ValueDescription
rowItems flow left-to-right (default).
row-reverseItems flow right-to-left.
columnItems flow top-to-bottom.
column-reverseItems flow bottom-to-top.
flex-wrapcontainer

Controls whether flex items are forced onto one line or can wrap onto multiple lines.

ValueDescription
nowrapAll items on one line (default). May overflow.
wrapItems wrap to next line when needed.
wrap-reverseItems wrap to the previous line.
justify-contentcontainer

Aligns flex items along the main axis (horizontal when flex-direction is row).

ValueDescription
flex-startItems pack to the start of the main axis (default).
flex-endItems pack to the end of the main axis.
centerItems are centered along the main axis.
space-betweenItems evenly distributed; first and last items at edges.
space-aroundItems evenly distributed with equal space around each.
space-evenlyItems have equal space between them and the edges.
align-itemscontainer

Aligns flex items along the cross axis (perpendicular to the main axis).

ValueDescription
stretchItems stretch to fill container height (default).
flex-startItems align to the start of the cross axis.
flex-endItems align to the end of the cross axis.
centerItems are centered along the cross axis.
baselineItems align by their text baselines.
align-contentcontainer

Aligns flex lines in a multi-line container (only applies when flex-wrap is set).

ValueDescription
flex-startLines pack to the start of the container.
flex-endLines pack to the end of the container.
centerLines centered in the container.
space-betweenLines evenly distributed.
space-aroundEqual space around each line.
stretchLines stretch to fill remaining space (default).
gapcontainer

Sets the gap between flex items. Shorthand for row-gap and column-gap.

ValueDescription
<length>Uniform gap between all items. E.g. gap: 16px;
<row-gap> <col-gap>Different row and column gaps. E.g. gap: 8px 16px;
flex-growitem

Defines how much a flex item grows relative to the rest when there is extra space on the main axis.

ValueDescription
0Item does not grow (default).
1Item grows to fill available space.
<number>Item grows proportionally. E.g. flex-grow: 2 gets twice as much extra space.
flex-shrinkitem

Defines how much a flex item shrinks relative to the rest when there is not enough space.

ValueDescription
1Item shrinks proportionally (default).
0Item does not shrink.
<number>Item shrinks more/less than others.
flex-basisitem

Sets the initial main size of a flex item before flex-grow and flex-shrink distribute space.

ValueDescription
autoUses item's width/height property (default).
0Ignores item size; distributes space purely by flex-grow ratio.
<length | %>Explicit starting size. E.g. flex-basis: 200px;
flexitem

Shorthand for flex-grow, flex-shrink, and flex-basis.

ValueDescription
1Equivalent to flex: 1 1 0%. Grows and shrinks equally.
autoEquivalent to flex: 1 1 auto. Grows/shrinks based on content.
noneEquivalent to flex: 0 0 auto. Fully rigid.
<grow> <shrink> <basis>E.g. flex: 2 1 200px.
align-selfitem

Overrides the align-items value for a single flex item.

ValueDescription
autoUses the parent's align-items value (default).
flex-startAligns item to the start of the cross axis.
flex-endAligns item to the end of the cross axis.
centerCenters item on the cross axis.
baselineAligns item by its baseline.
stretchStretches item to fill container.
orderitem

Controls the order in which flex items appear in the flex container.

ValueDescription
0Default order (source order).
-1Move item before items with order 0.
<integer>Higher numbers appear later. Items with same order use source order.

Layout Suggester

Describe the layout you need and get suggested flexbox properties.

Share

marduc812

2026