Jul 21, 2025
This lecture explains the CSS justify-content property, which controls how space is distributed between and around items along the main (or inline) axis in flex, grid, and multicol containers.
justify-content determines space distribution between/around content items along the main axis of flex containers and inline axis of grids/multicols.start, end, center, flex-start, flex-end, left, right.normal (acts as stretch, or as start in flex).space-between, space-around, space-evenly, stretch.safe center,unsafe center.inherit, initial, revert, unset.start/end: Items flush to the start/end edge of container.flex-start/flex-end: Like start/end but specific to flex containers.center: Items centered along the axis.left/right: Items flush to left/right edge (depends on writing mode).normal: Behaves as stretch or start depending on layout.space-between: Equal space between items, first and last touch container edges.space-around: Equal space between items, half-space at edges.space-evenly: Equal space before, between, and after items.stretch: Auto-sized items expand to fill space equally.safe: Prevents overflow by aligning as start if overflow would occur.unsafe: Allows desired alignment even if overflow occurs.justify-content to have any visible effect.justify-content: space-evenly distributes space equally before, between, and after columns.safe keyword prevents center alignment if overflowing; items align at the start.safe vs. unsafe).justify-content values in flex and grid layouts.safe and unsafe to see overflow alignment in action.align-content, flex-grow, and grid-template-columns.