Skip to content

Flex

Utility classes for controlling flex layouts. Provides flexible alignment and distribution capabilities through flex properties. More adaptive than traditional grid systems for complex layouts.

Basic Usage

Basic Usage

Direction Control

Use .flex-row (default) or .flex-row-reverse for horizontal layouts:

Horizontal Direction

Use .flex-column or .flex-column-reverse for vertical layouts:

Vertical Direction

Content Alignment

Control main axis alignment with .justify-content-* (start/end/center/between/around/evenly):

Main Axis Alignment

Control cross axis alignment with .align-items-* (start/end/center/baseline/stretch):

Cross Axis Alignment

Multi-line alignment with .align-content-* (start/end/center/between/around/stretch):

Multi-line Alignment

Individual Alignment

Adjust single item alignment with .align-self-*:

Individual Alignment

Item Scaling

Equal-width items with .flex-fill:

Item Fill

Growth control with .flex-grow-*:

Item Growth

Shrink control with .flex-shrink-*:

Item Shrink

Order Adjustment

Modify visual order with .order-*:

Order Adjustment

Quick Reference

ClassStyles
.d-flexdisplay: flex
.d-inline-flexdisplay: inline-flex
.flex-fillflex: 1 1 auto
.flex-rowflex-direction: row
.flex-row-reverseflex-direction: row-reverse
.flex-columnflex-direction: column
.flex-column-reverseflex-direction: column-reverse
.flex-wrapflex-wrap: wrap
.flex-nowrapflex-wrap: nowrap
.flex-wrap-reverseflex-wrap: wrap-reverse
.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
.align-items-startalign-items: flex-start
.align-items-endalign-items: flex-end
.align-items-centeralign-items: center
.align-items-baselinealign-items: baseline
.align-items-stretchalign-items: stretch
.align-content-startalign-content: flex-start
.align-content-endalign-content: flex-end
.align-content-centeralign-content: center
.align-content-betweenalign-content: space-between
.align-content-aroundalign-content: space-around
.align-content-stretchalign-content: stretch
.align-self-startalign-self: flex-start
.align-self-endalign-self: flex-end
.align-self-centeralign-self: center
.align-self-baselinealign-self: baseline
.align-self-stretchalign-self: stretch
.flex-grow-0flex-grow: 0
.flex-grow-1flex-grow: 1
.flex-shrink-0flex-shrink: 0
.flex-shrink-1flex-shrink: 1
.order-firstorder: -1
.order-1order: 1
.order-2order: 2
.order-3order: 3
.order-4order: 4
.order-5order: 5
.order-lastorder: 6

All classes support responsive prefixes like sm:, md:, lg:, xl: etc.