HomeGuideLabGlossary

Align and distribute flex lines in the cross direction with

This works the same as , but we’re moving flex lines instead of flex items.

Instead of the flex container’s main size, we take the flex container’s cross size.

1crosssize

Instead of moving flex item margin boxes inside a flex line, we move the flex lines inside a flex container.

11crosssize1

If is normal or stretch, then the flex lines were already stretched before.

And nothing happens in this step anymore.

crosssize1We’re done

How this works

Take the remaining space calculated in the previous chapter.

Remaining space1flex containercrosssizeflex line cross sizeremainingspace

Check the value of .

align-content?

If it’s an alignment value, use the “magnets method” to align the flex lines within the flex container.

align-content: flex-end1cross-startcross-endCLICK

If it’s a distribution value, then split the remaining space according to that value.

align-content: space-between12cross-startcross-end

If there’s no remaining space, distribution values have fallback alignment values.

For example, space-around falls back on `center.

align-content: space-aroundcross-startcross-end12

Gaps are always inserted between flex lines.

If the flex container declared a gap between flex lines, then it’s always inserted.

align-content: flex-end12cross-startcross-endCLICK

These gaps are added to spaces distributed by the distribution properties. So you might up with larger spaces between the flex lines than you would expect.

align-content: space-evenly12cross-startcross-end