CSS UtilitiesJustify Content

Justify Content

These utility classes control how space is distributed between items along a flex or grid container’s main axis, which is the axis its children flow along. Reach for them when you want to push items to one end of a cluster or stack, center a row of buttons, or spread a set of navigation links evenly across a header.

Class Namejustify-content ValuePreview
cs-justify-content-startflex-start
cs-justify-content-endflex-end
cs-justify-content-centercenter
cs-justify-content-space-aroundspace-around
cs-justify-content-space-betweenspace-between
cs-justify-content-space-evenlyspace-evenly

What’s the Main Axis?

The main axis runs parallel to a container’s content direction. For grid containers and flex containers where flex-direction is row, the main axis runs in the inline direction. For containers where flex-direction is column, the main axis runs in the block direction.