Flex Utilities
On this page
# Flex
The flex utility controls how flex items grow and shrink.
--flex utility, where applicable, in order for them to function properly. All flex utilities have responsive variants for each breakpoint. Use --xs-{utility}, --sm-{utility}, --md-{utility}, --lg-{utility}, --xl-{utility}. | Class | Properties |
|---|---|
| --flex-all | flex: 1 1 0%; |
| --flex-auto | flex: 1 1 auto; |
| --flex-initial | flex: 0 1 auto; |
| --flex-none | flex: none; |
# Direction
The flex direction utility controls the direction of flex items.
| Class | Properties |
|---|---|
| --flex-row | flex-direction: row; |
| --flex-row-reverse | flex-direction: row-reverse; |
| --flex-column | flex-direction: column; |
| --flex-column-reverse | flex-direction: column-reverse; |
# Grow
The flex grow utility controls how flex items grow.
| Class | Properties |
|---|---|
| --flex-grow-0 | flex-grow: 0; |
| --flex-grow | flex-grow: 1; |
# Order
The flex order utility controls the order of flex items.
| Class | Properties |
|---|---|
| --flex-order-1 | order: 1; |
| --flex-order-2 | order: 2; |
| --flex-order-3 | order: 3; |
| --flex-order-4 | order: 4; |
| --flex-order-5 | order: 5; |
| --flex-order-6 | order: 6; |
| --flex-order-7 | order: 7; |
| --flex-order-8 | order: 8; |
| --flex-order-9 | order: 9; |
| --flex-order-10 | order: 10; |
| --flex-order-11 | order: 11; |
| --flex-order-12 | order: 12; |
| --flex-order-first | order: -9999; |
| --flex-order-last | order: 9999; |
| --flex-order-0 | order: 0; |
# Shrink
The flex shrink utility controls how flex items shrinks.
| Class | Properties |
|---|---|
| --flex-shrink-0 | flex-shrink: 0; |
| --flex-shrink | flex-shrink: 1; |
# Wrap
The flex wrap utility controls how flex items wrap.
| Class | Properties |
|---|---|
| --flex-wrap | flex-wrap: wrap; |
| --flex-wrap-reverse | flex-wrap: wrap-reverse; |
| --flex-nowrap | flex-wrap: nowrap; |
# Alignment
You can change the alignments of flex rows and items by using the following alignment utilities:
# Align Content
The align content utility controls how flex rows are positioned vertically inside the flex containers. This utility is used on the flex containers themselves.
| Class | Properties |
|---|---|
| --content-around | align-content: space-around; |
| --content-between | align-content: space-between; |
| --content-center | align-content: center; |
| --content-end | align-content: flex-end; |
| --content-evenly | align-content: space-evenly; |
| --content-start | align-content: flex-start; |
# Align Items
The align items utility controls how flex items are positioned vertically inside flex containers. This utility is used on the flex containers themselves.
| Class | Properties |
|---|---|
| --items-baseline | align-items: baseline; |
| --items-center | align-items: center; |
| --items-end | align-items: flex-end; |
| --items-start | align-items: flex-start; |
| --items-stretch | align-items: stretch; |
# Align Self
The align self utility controls how flex items are positioned vertically inside flex containers or rows. This utility is used on the flex items themselves.
| Class | Properties |
|---|---|
| --self-auto | align-self: auto; |
| --self-center | align-self: center; |
| --self-end | align-self: flex-end; |
| --self-start | align-self: flex-start; |
| --self-stretch | align-self: stretch; |
# Justify Content
The justify content utility controls how flex rows are positioned horizontally inside the flex containers. This utility is used on the flex containers themselves.
| Class | Properties |
|---|---|
| --justify-around | justify-content: space-around; |
| --justify-between | justify-content: space-between; |
| --justify-center | justify-content: center; |
| --justify-end | justify-content: flex-end; |
| --justify-evenly | justify-content: space-evenly; |
| --justify-start | justify-content: flex-start; |
# Justify Items
The justify items utility controls how flex items are positioned horizontally inside flex containers. This utility is used on the flex containers themselves.
| Class | Properties |
|---|---|
| --justify-items-auto | justify-items: auto; |
| --justify-items-center | justify-items: center; |
| --justify-items-end | justify-items: end; |
| --justify-items-start | justify-items: start; |
| --justify-items-stretch | justify-items: stretch; |
# Justify Self
The justify self utility controls how flex items are positioned horizontally inside flex containers or rows. This utility is used on the flex items themselves.
| Class | Properties |
|---|---|
| --justify-self-auto | justify-self: auto; |
| --justify-self-center | justify-self: center; |
| --justify-self-end | justify-self: flex-end; |
| --justify-self-start | justify-self: flex-start; |
| --justify-self-stretch | justify-self: stretch; |