Flex
Display Flex
Section titled “Display Flex”Use these utility classes to make elements become flex containers.
ClassValueCopy
.d-flexdisplay: flex.d-inline-flexdisplay: inline-flex
Breakpoint infixes
Section titled “Breakpoint infixes”Add the viewport sizing infixes (sm, md, lg, xl, xxl) to apply at breakpoints.
Note: these infixes apply to all Flex utilities, for example align-items-xl-end.
| XS | Small | Medium | Large | XL | XXL | Copy | |
|---|---|---|---|---|---|---|---|
.d-flex | Flexes | Flexes | Flexes | Flexes | Flexes | Flexes | |
.d-sm-flex | Doesn’t Flex | Flexes | Flexes | Flexes | Flexes | Flexes | |
.d-md-flex | Doesn’t Flex | Doesn’t Flex | Flexes | Flexes | Flexes | Flexes | |
.d-lg-flex | Doesn’t Flex | Doesn’t Flex | Doesn’t Flex | Flexes | Flexes | Flexes | |
.d-xl-flex | Doesn’t Flex | Doesn’t Flex | Doesn’t Flex | Doesn’t Flex | Flexes | Flexes | |
.d-xxl-flex | Doesn’t Flex | Doesn’t Flex | Doesn’t Flex | Doesn’t Flex | Doesn’t Flex | Flexes |
Align-items
Section titled “Align-items”ClassValueCopy
.align-items-stretchalign-items: stretch.align-items-startalign-items: start.align-items-endalign-items: end.align-items-centeralign-items: center.align-items-baselinealign-items: baseline
Visual examples
Section titled “Visual examples”.align-items-stretch
.align-items-start
.align-items-end
.align-items-center
.align-items-baseline
Align-self
Section titled “Align-self”Apply on flex items (as opposed to .align-items which is applied to flex containers).
ClassValueCopy
.align-self-stretchalign-self: stretch.align-self-startalign-self: start.align-self-endalign-self: end.align-self-centeralign-self: center.align-self-baselinealign-self: baseline
Justify-content
Section titled “Justify-content”ClassValueCopy
.justify-content-startjustify-content: start.justify-content-endjustify-content: end.justify-content-centerjustify-content: center.justify-content-betweenjustify-content: between.justify-content-aroundjustify-content: around.justify-content-evenlyjustify-evenly: between
Visual examples
Section titled “Visual examples”.justify-content-start
.justify-content-end
.justify-content-center
.justify-content-between
.justify-content-around
.justify-content-evenly
Flex-direction
Section titled “Flex-direction”ClassValueCopy
.flex-rowflex-direction: row.flex-columnflex-direction: column.flex-row-reverseflex-direction: row-reverse.flex-column-reverseflex-direction: column-reverse
Visual examples
Section titled “Visual examples”.flex-row
The default is flex-direction: row which is “left to right” along
X axis. This is the default and you do need to declare this (unless you do).
The following classes allow permutations:
.flex-column
Changes the main axis to Y (from the default X asis) i.e. “top to bottom”.
.flex-row-reverse
Reverses the X axis to “right to left”.
.flex-column-reverse
Reverses the Y axis to “bottom to top”.
Other flex utility classes
Section titled “Other flex utility classes”Apply on flex items (as opposed to .flex-row-reverse which is applied to flex containers).
ClassValueCopy
.order-firstorder: -1.order-1order: 1.order-2order: 2.order-3order: 3.order-4order: 4.order-5order: 5.order-lastorder: 6
ClassValueCopy
.flex-grow-0flex-grow: 0.flex-grow-1flex-grow: 1.flex-shrink-0flex-shrink: 0.flex-shrink-1flex-shrink: 1
ClassValueCopy
.flex-wrapflex-wrap: wrap.flex-nowrapflex-wrap: nowrap.flex-wrap-reverseflex-wrap: reverse