CSS flex-basis Property
Description
The flex-basis property defines the initial main size of a flex item that the flex layout algorithm uses as its starting point before distributing free space. It establishes the baseline measurement against which the container decides whether an item should grow or shrink; because this baseline is measured along the container’s main axis, the effective dimension can correspond to the item’s width or height depending on the container’s orientation. Think of it as the “intended” size the algorithm begins with, rather than the final size after flexible adjustments.
That baseline interacts directly with an item’s growth and shrink behavior: the flex-grow factor determines how remaining positive free space is apportioned relative to each item’s base size, while the flex-shrink factor controls how items contract when the container has less space than the sum of their bases. The flex shorthand commonly sets these behaviors together, but an explicit base provided via flex-basis will be the reference used by the algorithm for that item.
In layout scenarios where an item already has an explicit main-size (for example a set width), that dimension can serve as the starting point unless a different base is specified; however, final computed sizes are still subject to constraints such as min-width, which can prevent items from shrinking below or growing above certain limits. Using flex-basis gives you fine-grained control over how items enter the flexing process, enabling predictable distribution of space and clearer relationships between fixed sizing intent and flexible behavior.
Definition
- Initial value
- auto
- Applies to
- Flex items, including in-flow pseudo-elements
- Inherited
- No
- Computed value
- As specified, but with relative lengths converted into absolute lengths
- Animatable
- Yes
- JavaScript syntax
- object.style.flexBasis
Interactive Demo
Syntax
flex-basis: auto | <size>
Values
- autoIndicates auto size based on the content of the item.
- <size>Specifies the size of the element in px, mm, pt or in percent along the main axis. In this case, the size is calculated relative to the parent. A negative value is not valid.
Example
Browser Support
The following information will show you the current browser support for the CSS flex-basis property. Hover over a browser icon to see the version that first introduced support for this CSS property.
This property is supported by all modern browsers.
Desktop
Tablets & Mobile
Last updated by CSSPortal on: 1st January 2026
