Skip to content

Alignment

Alignment utilities distribute items inside a flex or grid container. They do not create the container; pair them with d-flex or grid.

justify-content-* distributes items on the main axis. align-items-* aligns items on the cross axis. align-self-* overrides one child, and align-content-* distributes wrapped lines.

Family Values
justify-content-* start, end, center, between, around
align-items-* start, end, center, baseline, stretch
align-self-* start, end, center, baseline, stretch
align-content-* start, end, center, baseline, stretch
<div class="d-flex justify-content-between align-items-center">
<strong>Title</strong>
<span class="text-muted">Meta</span>
</div>

Compact aliases: justify-start, justify-center, justify-end, justify-between, justify-around, justify-evenly, and items-*. justify-content-start maps to start, while justify-start maps to flex-start; both are valid and behave the same in a flex container.

Breakpoints go after the family name:

<div class="d-flex flex-column align-items-start align-items-md-center">
<span>One</span>
<span>Two</span>
</div>

Responsive: justify-content-md-between, align-items-lg-center, align-self-xl-start, align-content-2xl-stretch.

These classes are in the separate responsive module: import nightcss/utilities/responsive after the base bundle, or use nightcss/full.

The main axis follows flex-direction. In a column container, justify-content moves items vertically and align-items horizontally. Grid containers use the same two families for their tracks and items.

For a container centered on both axes in one class, use flex-center on the Flex page. For spacing between items, use Gap.