Flex
Display Flex
Use these utility classes to make elements become flex containers.
ClassValueCopy
.d-flex
display: flex.d-inline-flex
display: inline-flex
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
ClassValueCopy
.align-items-stretch
align-items: stretch.align-items-start
align-items: start.align-items-end
align-items: end.align-items-center
align-items: center.align-items-baseline
align-items: baseline
Visual examples
.align-items-stretch
.align-items-start
.align-items-end
.align-items-center
.align-items-baseline
Align-self
Apply on flex items (as opposed to .align-items
which is applied to flex containers).
ClassValueCopy
.align-self-stretch
align-self: stretch.align-self-start
align-self: start.align-self-end
align-self: end.align-self-center
align-self: center.align-self-baseline
align-self: baseline
Justify-content
ClassValueCopy
.justify-content-start
justify-content: start.justify-content-end
justify-content: end.justify-content-center
justify-content: center.justify-content-between
justify-content: between.justify-content-around
justify-content: around.justify-content-evenly
justify-evenly: between
Visual examples
.justify-content-start
.justify-content-end
.justify-content-center
.justify-content-between
.justify-content-around
.justify-content-evenly
Flex-direction
ClassValueCopy
.flex-row
flex-direction: row.flex-column
flex-direction: column.flex-row-reverse
flex-direction: row-reverse.flex-column-reverse
flex-direction: column-reverse
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
Order
Apply on flex items (as opposed to .flex-row-reverse
which is applied to flex containers).
ClassValueCopy
.order-first
order: -1.order-1
order: 1.order-2
order: 2.order-3
order: 3.order-4
order: 4.order-5
order: 5.order-last
order: 6
Grow and shrink
ClassValueCopy
.flex-grow-0
flex-grow: 0.flex-grow-1
flex-grow: 1.flex-shrink-0
flex-shrink: 0.flex-shrink-1
flex-shrink: 1
Wrap
ClassValueCopy
.flex-wrap
flex-wrap: wrap.flex-nowrap
flex-wrap: nowrap.flex-wrap-reverse
flex-wrap: reverse