Shrink
Flex shrinking is the Flexbox behavior that reduces flex-item sizes and distributes insufficient space according to shrink factors and size constraints.
Web Design Playground
A flexbox sizing behavior that determines how a flex item reduces in size when space is limited.
- How it is used
- Controls how flex items give up space when they do not fit their container.
- How deep it goes
- Explains default and custom values, initial-width effects, and content minimums without working through the shrinkage math.
- Examples
- Uses a thumbnail-and-text list and a header logo that must not shrink.
- What you can do after
- Build it from scratch: create a flexbox thumbnail list whose image does not shrink while its text uses remaining space.
Math for Web Design
The flex shrinking algorithm is the Flexbox procedure for distributing negative free space among shrinkable flex items according to their flex-shrink factors and size constraints.
- How it is used
- Distributes a flex container’s width shortage among items whose starting sizes do not fit.
- How deep it goes
- Works through weighted factors, overflow shares, final widths, and redistribution after a minimum-width constraint.
- Examples
- Calculates three 450px items inside 600px and applies a 100px minimum width; also sizes buttons in a toolbar.
- What you can do after
- Diagnose/debug with it when flex items shrink unequally, hit minimum widths, or shrink despite an earlier property setting.
Web Design Playground, Second Edition
The CSS flex-shrink property specifies how much a flex item may contract relative to the other flex items when insufficient space is available.
- How it is used
- Controls how flex items contract when they lack room in their container.
- How deep it goes
- Explains default and relative values, initial-width effects, and a content-size limit, but defers the shrinkage calculations.
- Examples
- Uses differently sized flex items and a thumbnail list whose image does not shrink beside growing text.
- What you can do after
- Operate/configure it with CSS values to control which flex items shrink and which retain their size.
Read how Web Design Playground, Second Edition explains shrink →
CSS in Depth, Second Edition
The CSS flex-shrink property specifies a flex item's shrink factor when the flex items' initial sizes exceed the available space in the flex container.
- How it is used
- Prevents flex layouts from overflowing when initial item sizes exceed the container’s available main-axis space.
- How deep it goes
- Explains zero and positive factors, proportional contraction, initial-size effects, gaps, padding, and column-direction constraints.
- Examples
- Demonstrates two percentage-based columns separated by a gap and nested tiles in a vertical flexbox.
- What you can do after
- Build it from scratch by choosing shrink factors for columns and predicting when constrained flex items will contract.
Also covered in
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.
- flexboxFlexbox is a CSS one-dimensional layout model for arranging, sizing, aligning, and distributing items along a row or column.
- main axisThe main axis is the primary direction in which a flex container arranges and distributes its flex items.
Related concepts
- flexconfigured by · The CSS flex property is a shorthand that sets a flex item’s flex-grow, flex-shrink, and flex-basis values.
- flex itemuses · A flex item is a child of a flex container that participates in its flexible layout.
- flexboxused by · Flexbox is a CSS one-dimensional layout model for arranging, sizing, aligning, and distributing items along a row or column.
- overflowaddressed by · Content overflow is the condition in which content extends beyond the bounds of its containing box or viewport.
- flex-basisuses · The CSS flex-basis property specifies a flex item’s initial size along the flex container’s main axis before available space is distributed.
Questions about shrink
What is shrink?
Flex shrinking is the Flexbox behavior that reduces flex-item sizes and distributes insufficient space according to shrink factors and size constraints.
Which Manning books explain shrink?
Web Design Playground, Math for Web Design, Web Design Playground, Second Edition and CSS in Depth, Second Edition.
What should I know before learning shrink?
Manning books that teach shrink usually introduce flex container, width, flexbox and main axis first.
What is shrink a kind of?
Shrink is a kind of flex factor. A flex factor is either a flex-grow or flex-shrink value that controls an item's participation in Flexbox space distribution.
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.



