Skip to content

Flex

Flexbox utilities. Activate with d-flex or d-inline-flex.

Direction

Classflex-direction
flex-rowrow
flex-colcolumn

Wrap

Classflex-wrap
flex-wrapwrap
flex-nowrapnowrap
flex-wrap-reversewrap-reverse

Justify content

Classjustify-content
justify-startflex-start
justify-endflex-end
justify-centercenter
justify-betweenspace-between
justify-aroundspace-around
justify-evenlyspace-evenly

Align items

Classalign-items
items-startflex-start
items-endflex-end
items-centercenter
items-baselinebaseline
items-stretchstretch

Legacy aliases (align-items)

These classes work but items-* is preferred:

Classalign-items
align-startflex-start
align-centercenter
align-endflex-end
align-baselinebaseline
align-stretchstretch

Align self

Classalign-self
self-startflex-start
self-endflex-end
self-centercenter
self-baselinebaseline
self-stretchstretch

Align content

Classalign-content
content-startflex-start
content-endflex-end
content-centercenter
content-betweenspace-between
content-aroundspace-around

Order

Classorder
order-1order-12112

Grow and shrink

ClassPropertyValue
grow-0flex-grow0
grow-1flex-grow1
shrink-0flex-shrink0
shrink-1flex-shrink1

Responsive variants

All classes support responsive prefixes:

html
<div class="d-flex flex-col md:flex-row">
  Column on mobile, row on tablet
</div>

Examples

html
<!-- Center content -->
<div class="d-flex justify-center items-center" style="height: 100px">
  Centered
</div>

<!-- Space between nav items -->
<nav class="d-flex justify-between items-center pa-4">
  <span>Logo</span>
  <span>Menu</span>
</nav>

<!-- Wrapping columns -->
<div class="d-flex flex-wrap gap-4">
  <div class="grow-1">Column 1</div>
  <div class="grow-1">Column 2</div>
  <div class="grow-1">Column 3</div>
</div>

<!-- Fixed sidebar, flexible content -->
<div class="d-flex">
  <div class="shrink-0" style="width: 200px">Sidebar</div>
  <div class="grow-1">Content</div>
</div>