A flex item needs a starting size before it grows or shrinks to fit its container. `flex-basis` suggests that starting size. Think of it as giving each item a place to start, not necessarily its final size. section 12.6
To choose a basis, follow the container’s direction:
- In a row, the basis sets a starting width. In a column, it sets a starting height. section 12.6
- Use a measurement such as `10em`, or a percentage, when you want to suggest a specific size. section 12.6
- Use `auto` to start from the item’s width or height property. Without one, `auto` uses the content-based size; `content` requests that content-based size directly. section 12.6
item {
flex-basis: value|auto|content;
}
The rule shows the three choices: a measured value, `auto`, or `content`. Replace `value` with a CSS measurement or percentage. section 12.6
Give a wrapping block room to breathe
In a flexible page layout, `flex-wrap` lets blocks move onto another line when horizontal room runs out. Add a `flex-basis` value to establish a minimum block width, and set `flex-shrink: 0` so the block does not shrink below it. Try changing the viewport width in the flexible-layout Playground (`wdpg.io/13-3-1`) and watch when the blocks wrap. section 13.9
You can also set the basis alongside growth and shrink settings with the `flex` shorthand. For example, `flex: 0 0 10em` gives an item a fixed size of `10em`. Start with `flex-basis` when the question is simply, “How big should this item be before flexbox adjusts it?” section 12.6 section 12.18




