Skip to content

Flexbox

The flexbox object provides utility classes for building flexible layouts. The base .obj-flex class creates a flex container with wrapping enabled.

The .obj-flex class creates a flex container. Direction modifiers control the main axis.

ClassDescription
.obj-flex--rowRow direction (default)
.obj-flex--row-reverseReversed row direction
.obj-flex--columnColumn direction
.obj-flex--column-reverseReversed column direction
.obj-flex--nowrapDisable wrapping

Use .obj-flex--justify-content__<value> to control main-axis alignment.

ClassValue
.obj-flex--justify-content__flex-startflex-start
.obj-flex--justify-content__flex-endflex-end
.obj-flex--justify-content__centercenter
.obj-flex--justify-content__betweenspace-between
.obj-flex--justify-content__aroundspace-around
.obj-flex--justify-content__evenlyspace-evenly

Use .obj-flex--align-items__<value> to control cross-axis alignment.

ClassValue
.obj-flex--align-items__startflex-start
.obj-flex--align-items__endflex-end
.obj-flex--align-items__centercenter
.obj-flex--align-items__stretchstretch
.obj-flex--align-items__baselinebaseline

Use .obj-flex-item for flex children. Width modifiers are available at xs, sm, md, lg, and xl sizes. Responsive variants append @bp (e.g., .obj-flex-item__lg@md).

ModifierWidth
.obj-flex-item__xs10em
.obj-flex-item__sm15em
.obj-flex-item__md20em (default)
.obj-flex-item__lg30em
.obj-flex-item__xl40em

Three items laid out in a row using the default .obj-flex container.

Item A
Item B
Item C
<div class="obj-flex" style="gap: 0.5rem">
<div class="util-background-odyssey util-pad-all-md">Item A</div>
<div class="util-background-creamery util-pad-all-md">Item B</div>
<div class="util-background-odyssey util-pad-all-md">Item C</div>
</div>

Items stacked vertically using .obj-flex--column.

Column A
Column B
Column C
<div class="obj-flex obj-flex--column" style="gap: 0.5rem">
<div class="util-background-odyssey util-pad-all-md">Column A</div>
<div class="util-background-creamery util-pad-all-md">Column B</div>
<div class="util-background-odyssey util-pad-all-md">Column C</div>
</div>

Items rendered in reverse order using .obj-flex--row-reverse. The source order is First, Second, Third.

First
Second
Third
<div class="obj-flex obj-flex--row-reverse" style="gap: 0.5rem">
<div class="util-background-odyssey util-pad-all-md">First</div>
<div class="util-background-creamery util-pad-all-md">Second</div>
<div class="util-background-odyssey util-pad-all-md">Third</div>
</div>

Items grouped in the center of the container using .obj-flex--justify-content__center.

Center A
Center B
Center C
<div class="obj-flex obj-flex--justify-content__center" style="gap: 0.5rem">
<div class="util-background-odyssey util-pad-all-md">Center A</div>
<div class="util-background-creamery util-pad-all-md">Center B</div>
<div class="util-background-odyssey util-pad-all-md">Center C</div>
</div>

Items spread to the edges with equal space between them using .obj-flex--justify-content__between.

Start
Middle
End
<div class="obj-flex obj-flex--justify-content__between">
<div class="util-background-odyssey util-pad-all-md">Start</div>
<div class="util-background-creamery util-pad-all-md">Middle</div>
<div class="util-background-odyssey util-pad-all-md">End</div>
</div>

Items distributed with equal space around and between them using .obj-flex--justify-content__evenly.

Even A
Even B
Even C
<div class="obj-flex obj-flex--justify-content__evenly">
<div class="util-background-odyssey util-pad-all-md">Even A</div>
<div class="util-background-creamery util-pad-all-md">Even B</div>
<div class="util-background-odyssey util-pad-all-md">Even C</div>
</div>

Items of varying height vertically centered on the cross axis using .obj-flex--align-items__center.

Short
Tall
Short
<div
class="obj-flex obj-flex--align-items__center"
style="gap: 0.5rem; min-height: 120px"
>
<div class="util-background-odyssey util-pad-all-sm">Short</div>
<div
class="util-background-creamery util-pad-all-md"
style="padding-top: 2rem; padding-bottom: 2rem"
>
Tall
</div>
<div class="util-background-odyssey util-pad-all-sm">Short</div>
</div>

Items stretched to fill the full height of the container using .obj-flex--align-items__stretch.

Stretched
Stretched
Stretched
<div
class="obj-flex obj-flex--align-items__stretch"
style="gap: 0.5rem; min-height: 120px"
>
<div class="util-background-odyssey util-pad-all-sm">Stretched</div>
<div class="util-background-creamery util-pad-all-sm">Stretched</div>
<div class="util-background-odyssey util-pad-all-sm">Stretched</div>
</div>

Items with different width modifiers: .obj-flex-item__sm (15em) and .obj-flex-item__lg (30em).

Small (15em)
Large (30em)
<div class="obj-flex">
<div
class="obj-flex-item obj-flex-item__sm util-background-odyssey util-pad-all-md"
>
Small (15em)
</div>
<div
class="obj-flex-item obj-flex-item__lg util-background-creamery util-pad-all-md"
>
Large (30em)
</div>
</div>