Flex-basis
The CSS flex-basis property specifies a flex item’s initial size along the flex container’s main axis before available space is distributed.
Web Design Playground
A CSS flexbox property that sets the initial main-size of a flex item before free space is distributed.
- How it is used
- Sets a suggested initial size for a flex item before growth or shrinkage adjusts it.
- How deep it goes
- Explains row and column sizing, measurement values, `auto`, `content`, and shorthand syntax without detailing a sizing algorithm.
- Examples
- Uses a `10em` shorthand declaration and a flexible-layout Playground where blocks wrap as the viewport narrows.
- What you can do after
- Apply it via CSS flex-basis and flex-shrink to set starting sizes and minimum block widths in a wrapping layout.
Web Design Playground, Second Edition
The CSS flex-basis property specifies the initial main-axis size of a flex item before available space is distributed.
- How it is used
- Suggests an initial size for a flex item before growth or shrinkage.
- How deep it goes
- Explains row and column sizing, three value choices, and shorthand syntax without descending into browser sizing internals.
- Examples
- Shows measured, auto, and content values, plus a `flex: 0 0 10em` fixed-size declaration.
- What you can do after
- Operate/configure it by choosing a flex item's suggested starting size with flex-basis or the flex shorthand.
Read how Web Design Playground, Second Edition explains flex-basis →
CSS in Depth, Second Edition
The CSS flex-basis property specifies a flex item’s initial size along the flex container’s main axis before free-space distribution.
- How it is used
- Sets each flex item’s starting main-axis size before flex-grow and flex-shrink resolve the final layout.
- How deep it goes
- Explains values, auto behavior, width precedence, free-space distribution, overflow, and column-axis effects.
- Examples
- Uses 20% items, two-thirds/one-third columns, percentage bases with gaps, and vertically stacked nested tiles.
- What you can do after
- Apply it via CSS Flexbox to create proportional, fixed, fluid, or vertically distributing layouts.
Tiny CSS Projects
The CSS flex-basis property specifies the initial main-size contribution of a flex item before space is distributed.
- How it is used
- Controls starting sizes within Flexbox layouts for equal groups and responsive side-by-side cards.
- How deep it goes
- Explains starting sizes and interactions with growth, shrinking, and gaps, without descending into layout-engine internals.
- Examples
- Uses equal profile-card likes and a responsive checkout layout with a 250px summary card.
- What you can do after
- Apply flex-basis in CSS to establish proportional or fixed starting sizes for flex items.
Math for Web Design
flex-basis is a CSS Flexbox property that specifies an item's initial size along the flex container's main axis before flexible growth or shrinkage.
- How it is used
- Sets the starting size used to calculate flexible growth, shrinkage, and space distribution in a flex container.
- How deep it goes
- Explains the selection algorithm, width and intrinsic-size fallbacks, shorthand interactions, and the point where grow/shrink calculations begin.
- Examples
- Uses fixed lengths, auto with width, auto with intrinsic content, width overrides, shorthand declarations, and a complete three-item row.
- What you can do after
- Diagnose unexpected flex item sizes by identifying the base size and checking whether shorthand declarations changed it.
What to know first
- flex containerA flex container is an element whose children are laid out as flex items according to the CSS Flexible Box Layout model.
- widthWidth is a measure of extent along a specified dimension, such as spatial size or the number of units or features in a model.
- main axisThe main axis is the primary direction in which a flex container arranges and distributes its flex items.
- viewportA viewport is the visible region of a browser or graphical interface in which a document or other content is displayed.
Related concepts
- flexpart of · The CSS flex property is a shorthand that sets a flex item’s flex-grow, flex-shrink, and flex-basis values.
- flex base sizeconfigures · A flex base size is the initial main-axis size assigned to a flex item before Flexbox distributes space by growing or shrinking items.
- JavaScriptconfigured by · JavaScript is a high-level, dynamically typed programming language standardized as ECMAScript and used for web and general-purpose programming.
- widthalternative to · Width is a measure of extent along a specified dimension, such as spatial size or the number of units or features in a model.
- shrinkused by · Flex shrinking is the Flexbox behavior that reduces flex-item sizes and distributes insufficient space according to shrink factors and size constraints.
Questions about flex-basis
What is flex-basis?
The CSS flex-basis property specifies a flex item’s initial size along the flex container’s main axis before available space is distributed.
Which Manning books explain flex-basis?
Web Design Playground, Web Design Playground, Second Edition, CSS in Depth, Second Edition, Tiny CSS Projects and Math for Web Design.
What should I know before learning flex-basis?
Manning books that teach flex-basis usually introduce flex container, width, main axis and viewport first.
What is the difference between flex-basis and width?
The CSS flex-basis property specifies a flex item’s initial size along the flex container’s main axis before available space is distributed. Width is a measure of extent along a specified dimension, such as spatial size or the number of units or features in a model.
What is flex-basis part of?
Flex-basis is part of flex. The CSS flex property is a shorthand that sets a flex item’s flex-grow, flex-shrink, and flex-basis values.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.




