Dozens of utility classes with a single purpose designed to reduce the frequency of highly repetitive declarations in your CSS while allowing for quick and easy development.
Flexbox
Use responsive flexbox utilites to control content layout.
Quickly manage the layout, alignment, and sizing of grid columns, navigation, components, and more with our responsive flexbox utilities. For more complex implementations, custom CSS may be necessary.
These classes are all available in responsive variants, in the form of .flex{-breakpoint}-{value}, such as .flex-lg-row. Please refer to how our breakpoint nomenclature is used.
Enable Flex Layout
Apply display utilities to create a flexbox container and transform direct children elements into flex items. Flex containers and items are able to be modified further with additional flex properties.
Set the direction of flex items in a flex container with direction utilities. In most cases you can omit the horizontal class here as the browser default is row. However, you may encounter situations where you needed to explicitly set this value (like responsive layouts).
Responsive direction utilities:
.flex{-breakpoint}-row
.flex{-breakpoint}-row-reverse
.flex{-breakpoint}-column
.flex{-breakpoint}-column-reverse
Use .flex-row to set a horizontal direction (the browser default), or .flex-row-reverse to start the horizontal direction from the opposite side.
Flex item 1
Flex item 2
Flex item 3
Flex item 1
Flex item 2
Flex item 3
Use .flex-column to set a vertical direction, or .flex-column-reverse to start the vertical direction from the opposite side.
Flex item 1
Flex item 2
Flex item 3
Flex item 1
Flex item 2
Flex item 3
Justify Content
Use the justify utilities on flexbox containers to change the justify-content property for the alignment of flex items on the main axis (the x-axis to start, y-axis if flex-direction: column). Choose from start (browser default), center, end, around, or between.
Responsive justify utilities:
.flex{-breakpoint}-start
.flex{-breakpoint}-center
.flex{-breakpoint}-end
.flex{-breakpoint}-around
.flex{-breakpoint}-between
.flex-start
Flex item
Justify at start of main axis
.flex-center
Flex item
Justify at center of main axis
.flex-end
Flex item
Justify at end of main axis
.flex-around
Flex item
Justify the space around
.flex-between
Flex item
Justify the space between
Align Items
Use flex-items utilities on flexbox containers to change the alignment of flex items on the cross axis (the y-axis to start, x-axis if flex-direction: column). Choose from start, center , end, baseline, or stretch (browser default).
Internet Explorer 10 and 11 do not support vertical alignment of flex items when the flex container has a min-height.See Flexbugs #3 for more details.
Responsive item alignment utilities:
.flex{-breakpoint}-items-start
.flex{-breakpoint}-items-center
.flex{-breakpoint}-items-end
.flex{-breakpoint}-items-baseline
.flex{-breakpoint}-items-stretch
.flex-items-start
Flex item
Align at cross axis start
.flex-items-center
Flex item
Align at cross axis center
.flex-items-end
Flex item
Align at cross axis end
.flex-items-baseline
Flex item
Align at baseline
.flex-items-stretch
Flex item
Stretch items
Align Self
Use flex-self utilities on flexbox items to individually change their alignment on the cross axis (the y-axis to start, x-axis if flex-direction: column). Choose from the same options as flex-items: start, center, end, baseline, or stretch (browser default).
Internet Explorer 10 and 11 do not support vertical alignment of flex items when the flex container has a min-height.See Flexbugs #3 for more details.
Responsive self alignment utilities:
.flex{-breakpoint}-self-start
.flex{-breakpoint}-self-center
.flex{-breakpoint}-self-end
.flex{-breakpoint}-self-baseline
.flex{-breakpoint}-self-stretch
Flex item
.flex-self-start
Flex item
Flex item
.flex-self-center
Flex item
Flex item
.flex-self-end
Flex item
Flex item
.flex-self-baseline
Flex item
Flex item
.flex-self-stretch
Flex item
Auto Margins
Flexbox can do some pretty awesome things when you mix flex alignments with auto margins.
Shown below are three examples of controlling flex items via auto margins: default (no auto margin), pushing two items to the end (.me-auto), and pushing two items to the start (.ms-auto).
Unfortunately, IE10 and IE11 do not properly support auto margins on flex items whose parent has a non-default justify-content value.See this StackOverflow answer for more details.
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
With align-items
Vertically, move one flex item to the top or bottom of a container by mixing align-items, flex-direction: column, and margin-top: auto or margin-bottom: auto.
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Wrap
Change how flex items wrap in a flex container. Choose from no wrapping at all (the browser default) with .flex-nowrap, wrapping with .flex-wrap, or reverse wrapping with .flex-wrap-reverse.
Responsive wrap utilities:
.flex{-breakpoint}-nowrap
.flex{-breakpoint}-wrap
.flex{-breakpoint}-wrap-reverse
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Order
Change the visual order of specific flex items with a handful of order utilities. We provide quick options for making an item first or last, as well as a reset to use the DOM order.
Quick responsive order utilities:
.order-{breakpoint}-first
.order-{breakpoint}-last
.order-{breakpoint}-unordered
Even greater control is available with responsive order classes that set a specific order value. These are in the form of .order-{breakpoint}-{col}, such as .order-2.order-md-4. Available order values include 1 through 6 across all breakpoints.
1
2
3
4
5
1
2
3
4
5
Align Content
Use flex-content utilities on flexbox containers to align flex items together on the cross axis. Choose from start (browser default), center, end, between, around, or stretch. To demonstrate these utilities, we’ve enforced flex-wrap: wrap and increased the number of flex items.
Heads up! This property has no effect on single rows of flex items.
Responsive align content utilities:
.flex{-breakpoint}-content-start
.flex{-breakpoint}-content-center
.flex{-breakpoint}-content-end
.flex{-breakpoint}-content-between
.flex{-breakpoint}-content-around
.flex{-breakpoint}-content-stretch
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Flex item
Sizing
Change the sizing of individual flexbox items to with sizing utilities.
Responsive sizing utilities:
.flex-{breakpoint}-fill
.flex-{breakpoint}-grow-0
.flex-{breakpoint}-grow-1
.flex-{breakpoint}-grow
.flex-{breakpoint}-shrink-0
.flex-{breakpoint}-shrink-1
.flex-{breakpoint}-shrink
.flex-{breakpoint}-none
To make an element grow or shrink as needed, use the .flex-fill utility.
Flex item
Auto sizing flex item - Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam rutrum ipsum ut efficitur imperdiet.
Flex item
Use .flex-grow-0/1 utilities to toggle a flex item’s ability to grow to fill available space. In the example below, the .flex-grow-1 elements uses all available space it can, while allowing the remaining two flex items their necessary space.
Flex item
Growing flex item - Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam rutrum ipsum ut efficitur imperdiet.
Flex item
To make an element grow, but not shrink, use the .flex-grow utility.
Flex item
Growing flex item - Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam rutrum ipsum ut efficitur imperdiet.
Flex item
Use .flex-shrink-0/1 utilities to toggle a flex item’s ability to shrink if necessary. In the example below, the second flex item with .flex-shrink-1 is forced to wrap it’s contents to a new line, “shrinking” to allow more space for the previous flex item with .w-100.
Flex item
Flex item
To make an element shrink, but not grow, use the .flex-shrink utility.
Flex item
Shrinking flex item - Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam rutrum ipsum ut efficitur imperdiet.
Flex item
To prevent an element from growing or shrinking, use the .flex-none utility.
Flex item
Non-flex item - Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam rutrum ipsum ut efficitur imperdiet.
Flex item
SASS Reference
Variables
The available Customization options, or Sass variables, that can be customized for this grouping of utility classes.
Name
Type
Default
Description
$enable-utility-flex
boolean
true
Enable the generation of the flex utility classes.
Smaller segements of the flex utilities can be disabled with the following $enable-* variables.
$enable-utility-flex-order
boolean
true
Enable the generation of the flex order utility classes.
$enable-utility-flex-direction
boolean
true
Enable the generation of the flex direction utility classes.
$enable-utility-flex-wrap
boolean
true
Enable the generation of the flex wrap utility classes.
$enable-utility-flex-justify
boolean
true
Enable the generation of the flex justify-content utility classes.
$enable-utility-flex-items
boolean
true
Enable the generation of the flex align-items utility classes.
$enable-utility-flex-content
boolean
true
Enable the generation of the flex align-content utility classes.
$enable-utility-flex-self
boolean
true
Enable the generation of the flex align-self utility classes.
$enable-utility-flex-sizing
boolean
true
Enable the generation of the flex sizing utility classes.
$utility-order-max
integer
6
Maximum value to use for generation of order utilities.