flex-grow
Widely availableSince 201597% of users
Defines the ability for a flex item to grow if necessary. It accepts a unitless value that serves as a proportion; it dictates how much of the available space inside the flex container the item should take up.
What's modern
From web-features, MDN's browser data and our snippets, checked dailyClassicIt has worked everywhere since September 2015.
See how modern your own CSS is.Check your CSS →
Quick facts
- Initial value
0- Inherited
- No
- Applies to
- flex items and in-flow pseudo-elements
- Animation type
- number
Quick example
.sidebar { flex-grow: 0; } /* stays fixed width */
.main-content { flex-grow: 1; } /* grows to fill all remaining space */Syntax
flex-grow: <number>0- Default. The item does not grow. It stays at the size defined by flex-basis or its content width.
1- The item takes an equal share of the remaining space alongside other items with flex-grow: 1.
Any positive number- The item takes a proportional share. An item with flex-grow: 2 gets twice the leftover space of an item with flex-grow: 1.
Examples
One item fills remaining space
.sidebar {
width: 240px;
flex-grow: 0;
}
.main {
flex-grow: 1;
}The sidebar stays at its fixed width. The main area grows to fill whatever space is left.
Equal columns
.column {
flex-grow: 1;
flex-basis: 0;
}All columns get an equal share of space. flex-basis: 0 means the base size is ignored, so distribution is based on flex-grow alone.
Proportional columns
.main {
flex-grow: 2;
}
.aside {
flex-grow: 1;
}The main column gets twice as much leftover space as the aside column.
Common pitfalls
- flex-grow does not mean widthflex-grow distributes leftover space, not total width. If one item has large content, it may end up wider than its flex-grow ratio suggests. Pair with flex-basis: 0 for true proportional widths.
- Default flex-basis affects distributionThe default flex-basis is auto, which uses content size as the base. Two items with flex-grow: 1 will only be equal widths if their content is the same size. Set flex-basis: 0 for predictable equal columns.
- flex-grow vs the flex shorthandflex: 1 is shorthand for flex: 1 1 0%, which sets flex-grow: 1, flex-shrink: 1, and flex-basis: 0. Writing flex-grow: 1 on its own leaves flex-basis at auto, which changes how space gets distributed.
See also
flex-grow browser support
BaselineWidely availableThis feature is well established and works across many devices and browser versions. It has been available across browsers since 2015.Safe to use without fallbacks.
Usage97%of people can use this3% use a browser without it.
Browsers
29+
20+
9+
12+Mobile
29+Android
20+Android
9+iOS