flex-basis
Defines the initial size of a flex item before the container distributes any remaining space. It works like width or height depending on the flex-direction.
Quick example
.flex-item {
flex-basis: 300px;
flex-grow: 1;
} /* starts at 300px, then grows to fill space */ Syntax
flex-basis: content | <length-percentage> | autoauto<length><percentage>0contentQuick facts
autoExamples
Equal columns that ignore content size
.columns > * {
flex-basis: 0;
flex-grow: 1;
} Start every item at size 0, then let flex-grow distribute space equally. All columns end up the same width regardless of their content.
Fixed starting size with room to grow
.card {
flex-basis: 240px;
flex-grow: 1;
} Card starts at 240px. If the container has extra space, the card grows. If there is not enough space, multiple cards in a row can wrap.
Size to content explicitly
.tag {
flex-basis: content;
} Forces the item to size based on its content even if width is set. Less common, but useful for overriding inherited widths.
flex-basis Browser Support
This 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.
Common pitfalls
With flex-basis: auto (the default), flex-grow distributes only what is left after each item's natural size. With flex-basis: 0, all space is up for grabs, so flex-grow ratios produce true equal or proportional widths. Use 0 for predictable layouts.
The shorthand flex: 1 expands to flex: 1 1 0%. Writing flex-grow: 1 on its own keeps flex-basis at auto, which gives different space distribution. Reach for flex: 1 when you want equal share behavior.
When flex-basis is auto, the item falls back to its width (or height). If you set both flex-basis and width, flex-basis wins on the main axis, but this confuses many developers. Set one or the other, not both.