CSS Box Alignment gives both layouts one vocabulary, built from two choices.
Which axis. justify-* works on the inline axis, align-* on the block axis. In flexbox, justify-* follows the main axis and align-* the cross axis, so flex-direction: column swaps them visually.
What moves.
*-contentdistributes space around the alignment subjects as a group: in grid, the tracks (only visible when the tracks are smaller than the container); in flexbox,justify-contentmoves the items on each line andalign-contentmoves the lines.align-contentdoes nothing in a single-line (nowrap) flex container.*-itemson the container sets the default*-selffor every child.*-selfaligns one item inside its alignment container: its grid area, or foralign-self, its flex line.
Flexbox has no justify-self or justify-items. There's more than one item in the main axis, so the spec makes them not apply. Use justify-content for the group and auto margins for individual items.
Auto margins go first. In flexbox, positive free space goes to auto margins before justify-content and align-self run, so margin-left: auto pushes an item, and everything after it, to the end and leaves justify-content nothing to distribute. In grid, margin: auto centres an item in its area.
normal is the initial value. It behaves as stretch for flex lines and for grid auto tracks; for grid items it stretches non-replaced boxes without a set size and start-aligns replaced ones like images.
place-* shorthands take the align value first: place-items: end start is align-items: end; justify-items: start.
gap (row-gap, column-gap) adds space between tracks or items only, never at the edges.
safe (justify-content: safe center) aligns as if it were flex-start when the item overflows, so content isn't pushed past the start edge where it can't be scrolled to.