Flexbox & GridJustify Self

Justify Self

Controls the alignment of a single grid element relative to its inline axis.

Widely available

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

Chrome
Edge
Firefox
Safari

js-autojustify-self: auto;
js-cjustify-self: center;
js-ejustify-self: end;
js-sjustify-self: start;
js-stjustify-self: stretch;

Auto

Initial value

The item will use the default alignment based on the container's alignment properties.

A
B
C
<div class="d-g g-4 gtc-3 c-white">
<div class="ai-c bg-indigo-8 d-f d-14 jc-c c-indigo-5">A</div>
<div class="ai-c bg-indigo d-f d-14 jc-c js-auto c-white">B</div>
<div class="ai-c bg-indigo-8 d-f d-14 jc-c c-indigo-5">C</div>
</div>

Center

The item will be centered within its grid area along the inline axis.

A
B
C
<div class="d-g g-4 gtc-3 c-white">
<div class="ai-c bg-indigo-8 d-f d-14 jc-c c-indigo-5">A</div>
<div class="ai-c bg-indigo d-f d-14 jc-c js-c c-white">B</div>
<div class="ai-c bg-indigo-8 d-f d-14 jc-c c-indigo-5">C</div>
</div>

End

The item will be aligned to the end of its grid area along the inline axis.

A
B
C
<div class="d-g g-4 gtc-3 c-white">
<div class="ai-c bg-indigo-8 d-f d-14 jc-c c-indigo-5">A</div>
<div class="ai-c bg-indigo d-f d-14 jc-c js-e c-white">B</div>
<div class="ai-c bg-indigo-8 d-f d-14 jc-c c-indigo-5">C</div>
</div>

Start

The item will be aligned to the start of its grid area along the inline axis.

A
B
C
<div class="d-g g-4 gtc-3 c-white">
<div class="ai-c bg-indigo-8 d-f d-14 jc-c c-indigo-5">A</div>
<div class="ai-c bg-indigo d-f d-14 jc-c js-s c-white">B</div>
<div class="ai-c bg-indigo-8 d-f d-14 jc-c c-indigo-5">C</div>
</div>

Stretch

The item will stretch to fill its grid area along the inline axis.

A
B
C
<div class="d-g g-4 gtc-3 c-white">
<div class="ai-c bg-indigo-8 d-f d-14 jc-c c-indigo-5">A</div>
<div class="ai-c bg-indigo d-f d-14 jc-c js-st c-white">B</div>
<div class="ai-c bg-indigo-8 d-f d-14 jc-c c-indigo-5">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.

Responsive design

Target different screen sizes by adding breakpoint prefixes. Styles apply from the specified breakpoint and up.

Target specific viewport sizes with breakpoint prefixes

sm:js-[value]
Small≥640px
md:js-[value]
Medium≥768px
lg:js-[value]
Large≥1024px
xxl:js-[value]
Extra Large≥1536px

Hover state variant

Apply styles conditionally when users hover over an element using the h: prefix.

Add the h: prefix to apply styles only when the user hovers over the element.

Syntax:h:js-[value]