Flex Grow, Shrink, Basis
HC · Flexboxsyntax
flex: grow shrink basis;
flex-grow: number;
flex-shrink: number;
flex-basis: size;example
.sidebar {
flex: 0 0 280px; /* fixed width, no grow or shrink */
}
.main-content {
flex: 1; /* grow to fill remaining space */
}
.equal-columns > * {
flex: 1 1 0%; /* equal width columns */
}Note flex: 1 is shorthand for flex: 1 1 0%, meaning the item can grow and shrink and starts from zero base size. flex-basis sets the initial size before growing/shrinking. Using 0% basis makes items share space equally.