FIND YOUR NEXT FEW LINES

The snippet library.

Small, practical examples. Search by task or narrow things down below.

10 snippets foundClear filters
CSSFlexbox alignment

Align flex items at the main-axis end

CSS: Flex-end uses the trailing edge of the flex container for packing.

CSS✓ Tested
CSSFlexbox alignment

Allow a long flex child to shrink inside its container

CSS: Min-width zero removes the default content-size floor so local overflow handling can take effect.

CSS✓ Tested
CSSFlexbox alignment

Change visual order without changing DOM order

CSS: Order changes flex painting positions while keyboard and reading order still follow the document.

CSS✓ Tested
CSSFlexbox alignment

Give an item the remaining horizontal space

CSS: A growing flex item absorbs free space after fixed items have been sized.

CSS✓ Tested
CSSFlexbox alignment

Override cross-axis alignment for one item

CSS: Align-self changes one item without changing its siblings’ alignment.

CSS✓ Tested
CSSFlexbox alignment

Prevent an item from shrinking

CSS: Flex-shrink zero preserves a required size even when the container overflows.

CSS✓ Tested
CSSFlexbox alignment

Push flex items to opposite ends

CSS: Space-between distributes free main-axis space between items.

CSS✓ Tested
CSSFlexbox alignment

Push one flex item away from its siblings

CSS: An auto inline-start margin consumes remaining main-axis space.

CSS✓ Tested
CSSFlexbox alignment

Specify a flex item’s initial main size

CSS: Flex-basis establishes the starting main-axis size before growth or shrinkage.

CSS✓ Tested
CSSFlexbox alignment

Stack flex items vertically

CSS: Flex-direction column makes the main axis vertical.

CSS✓ Tested