Flexbox & GridJustify Content

Justify Content

Controls the positioning of flex and grid elements on a container's main axis.

Widely available

This feature is well established and works across many devices and browser versions.

Chrome
Edge
Firefox
Safari
ClassStyle
jc-cjustify-content: center;
jc-fejustify-content: flex-end;
jc-fsjustify-content: flex-start;
jc-njustify-content: normal;
jc-stjustify-content: stretch;
jc-sajustify-content: space-around;
jc-sbjustify-content: space-between;
jc-sejustify-content: space-evenly;

Normal

Initial value

The items will be aligned according to the default alignment of the container.

A
B
C
<div class="d-f g-4 jc-n tc-white">
<div class="ai-c bg-indigo d-f d-14 jc-c d-16">A</div>
<div class="ai-c bg-indigo d-f d-14 jc-c d-16">B</div>
<div class="ai-c bg-indigo d-f d-14 jc-c d-16">C</div>
</div>

Center

The items will be centered within the container along the main axis.

A
B
C
<div class="d-f g-4 jc-c tc-white">
<div class="ai-c bg-indigo d-f d-14 jc-c d-16">A</div>
<div class="ai-c bg-indigo d-f d-14 jc-c d-16">B</div>
<div class="ai-c bg-indigo d-f d-14 jc-c d-16">C</div>
</div>

Flex End

The items will be aligned to the end of the container along the main axis.

A
B
C
<div class="d-f g-4 jc-fe tc-white">
<div class="ai-c bg-indigo d-f d-14 jc-c d-16">A</div>
<div class="ai-c bg-indigo d-f d-14 jc-c d-16">B</div>
<div class="ai-c bg-indigo d-f d-14 jc-c d-16">C</div>
</div>

Flex Start

The items will be aligned to the start of the container along the main axis.

A
B
C
<div class="d-f g-4 jc-fs tc-white">
<div class="ai-c bg-indigo d-f d-14 jc-c d-16">A</div>
<div class="ai-c bg-indigo d-f d-14 jc-c d-16">B</div>
<div class="ai-c bg-indigo d-f d-14 jc-c d-16">C</div>
</div>

Stretch

The items will stretch to fill the available space along the main axis.

A
B
C
<div class="tc-white">
<div class="d-g g-4 gaf-c jc-s">
<div class="ai-c bg-indigo d-f h-14 jc-c">A</div>
<div class="ai-c bg-indigo d-f h-14 jc-c">B</div>
<div class="ai-c bg-indigo d-f h-14 jc-c">C</div>
</div>
</div>

Space Between

The items will be evenly distributed in the container, with the first item at the start and the last item at the end.

A
B
C
<div class="d-f g-4 jc-sb tc-white">
<div class="ai-c bg-indigo d-f d-14 jc-c d-16">A</div>
<div class="ai-c bg-indigo d-f d-14 jc-c d-16">B</div>
<div class="ai-c bg-indigo d-f d-14 jc-c d-16">C</div>
</div>

Space Around

The items will be evenly distributed in the container with space around them.

A
B
C
<div class="d-f g-4 jc-sa tc-white">
<div class="ai-c bg-indigo d-f d-14 jc-c d-16">A</div>
<div class="ai-c bg-indigo d-f d-14 jc-c d-16">B</div>
<div class="ai-c bg-indigo d-f d-14 jc-c d-16">C</div>
</div>

Space Evenly

The items will be evenly distributed in the container with equal space around them.

A
B
C
<div class="d-f g-4 gaf-c jc-se tc-white">
<div class="ai-c bg-indigo d-f d-14 jc-c d-16">A</div>
<div class="ai-c bg-indigo d-f d-14 jc-c d-16">B</div>
<div class="ai-c bg-indigo d-f d-14 jc-c d-16">C</div>
</div>

Using utility variants

Learn how to override existing utilities based on the user's screen size or other factors, such as hover states.

Targeting different viewports

You can combine responsive breakpoints like sm:jc-*, md:jc-*, lg:jc-*, and xxl:jc-* to allow targeting specific utilities in different viewports.

Targeting hover states

Alternatively, you can apply :hover by using h:jc-* utility to override elements and change their values when hovering over them.