Justify Content

Utilities for controlling how flex and grid items are positioned along a container’s main axis.

Use justify-content utilities on flexbox containers to change the alignment of flex items on the main axis (the x-axis to start, y-axis if flex-direction: column). Choose from start (browser default), end, center, between, around, or evenly.

Quick reference

ClassProperties
.justify-content-startjustify-content: flex-start;
.justify-content-endjustify-content: flex-end;
.justify-content-centerjustify-content: center;
.justify-content-betweenjustify-content: space-between;
.justify-content-aroundjustify-content: space-around;
.justify-content-evenlyjustify-content: space-evenly;

Basic usage

Start

Use justify-content-start to justify items against the start of the container’s main axis:

01
02
03
<div class="d-flex justify-content-start">
  <div>01</div>
  <div>02</div>
  <div>03</div>
</div>

Center

Use justify-content-center to justify items along the center of the container’s main axis:

01
02
03
<div class="d-flex justify-content-center">
  <div>01</div>
  <div>02</div>
  <div>03</div>
</div>

End

Use justify-content-end to justify items against the end of the container’s main axis:

01
02
03
<div class="d-flex justify-content-end">
  <div>01</div>
  <div>02</div>
  <div>03</div>
</div>

Space between

Use justify-content-between to justify items along the container’s main axis such that there is an equal amount of space between each item:

01
02
03
<div class="d-flex justify-content-between">
  <div>01</div>
  <div>02</div>
  <div>03</div>
</div>

Space around

Use justify-content-around to justify items along the container’s main axis such that there is an equal amount of space on each side of each item:

01
02
03
<div class="d-flex justify-content-around ...">
  <div>01</div>
  <div>02</div>
  <div>03</div>
</div>

Space evenly

Use justify-content-evenly to justify items along the container’s main axis such that there is an equal amount of space around each item, but also accounting for the doubling of space you would normally see between each item when using justify-content-around:

01
02
03
<div class="d-flex justify-content-evenly ...">
  <div>01</div>
  <div>02</div>
  <div>03</div>
</div>

Breakpoints

All justify-content utilities that supports responsive at specific breakpoints, from xs to xxl, have no breakpoint abbreviation in them.

The responsive classes are named using the format justify-content-{breakpoint}-{value}.

  • .justify-content-sm-start
  • .justify-content-sm-end
  • .justify-content-sm-center
  • .justify-content-sm-between
  • .justify-content-sm-around
  • .justify-content-sm-evenly
  • .justify-content-md-start
  • .justify-content-md-end
  • .justify-content-md-center
  • .justify-content-md-between
  • .justify-content-md-around
  • .justify-content-md-evenly
  • .justify-content-lg-start
  • .justify-content-lg-end
  • .justify-content-lg-center
  • .justify-content-lg-between
  • .justify-content-lg-around
  • .justify-content-lg-evenly
  • .justify-content-xl-start
  • .justify-content-xl-end
  • .justify-content-xl-center
  • .justify-content-xl-between
  • .justify-content-xl-around
  • .justify-content-xl-evenly
  • .justify-content-xxl-start
  • .justify-content-xxl-end
  • .justify-content-xxl-center
  • .justify-content-xxl-between
  • .justify-content-xxl-around
  • .justify-content-xxl-evenly

For example, use justify-content-md-between to apply the justify-content-between utility at only medium screen sizes and above.

<div class="d-flex justify-content-start justify-content-md-between">
  <!-- ... -->
</div>