Flex Grow Shrink and Basis
Control how flex items grow, shrink, and set their base size using the flex shorthand.
The flex Shorthand
The flex shorthand on flex items sets three values: flex-grow, flex-shrink, flex-basis.
.item {
flex: 1 1 auto;
/* grow:1 shrink:1 basis:auto */
}flex-basis
flex-basis sets the initial size of a flex item before growing or shrinking. It overrides width (in row direction). auto uses the item's width or content size.
.sidebar { flex-basis: 250px; }
.main { flex-basis: auto; }All lessons in this course
- Display Flex and Flex Direction
- Justify-Content and Align-Items
- Flex Wrap and Align-Content
- Flex Grow Shrink and Basis