The flex-shrink property controls how much a flex item shrinks when the flex container runs out of space. It is essential for responsive layouts that must adapt on smaller screens without breaking.
01
Shrink factor
Unitless number.
02
Default 1
Items shrink.
03
Proportional
Ratios, not %.
04
Flex items
On children.
05
Main axis
Overflow space.
06
flex-shrink: 0
Lock item size.
Fundamentals
Introduction
The flex-shrink property in CSS is part of the Flexible Box Layout Module (Flexbox). It specifies the shrink factor of a flex item, which determines how much the item will shrink relative to the rest of the flex items in the flex container when there is not enough space.
Definition and Usage
Apply flex-shrink on flex items inside a container with display: flex. Use higher values when an item should give up more space under pressure — for example, a flexible content area with flex-shrink: 2 and a logo with flex-shrink: 0 so the logo never gets squashed.
💡
Beginner Tip
Think of flex-shrink as a share of overflow. If one item has flex-shrink: 2 and another has flex-shrink: 1, the first item loses twice as much width when the container is too narrow.
Foundation
📝 Syntax
The syntax for the flex-shrink property is straightforward. It is applied to flex items within a flex container:
syntax.css
element{flex-shrink:number;}
Here, number is a non-negative value that represents the shrink factor of the flex item.
Basic Example
flex-shrink-basic.css
.logo{flex-shrink:0;/* never shrink */}
flex-shrink: 0;flex-shrink: 1;flex-shrink: 2;
Default Value
The default value of the flex-shrink property is 1, which means flex items will shrink proportionally when the flex container has insufficient space.
Syntax Rules
Apply on flex items, not on the flex container.
Accepts non-negative numbers (0, 1, 2, etc.).
A value of 0 means the item will not shrink below its flex-basis (unless min-width forces otherwise).
Values are proportional ratios, not percentages or pixel sizes.
The property is not inherited.
Works along the main axis only (row or column depending on flex-direction).
Cheat Sheet
⚡ Quick Reference
Question
Answer
Initial value
1
Applies to
Flex items
Inherited
No
Value type
Unitless number (shrink factor)
Common pattern
flex-shrink: 0 on logos, icons, and sidebars
Reference
💎 Property Values
Value
Description
number
A non-negative integer that represents the shrink factor of the flex item. A value of 0 means the item will not shrink, while a higher value indicates a greater tendency to shrink relative to siblings.
How shrink factors divide overflow
If three items have shrink values of 1, 2, and 1, and the container needs to remove 200px of overflow, items 1 and 3 each give up 50px while item 2 gives up 100px — a 1:2:1 ratio. An item with flex-shrink: 0 is excluded from shrinking entirely.
Preview
👀 Live Preview
A 280px container with three 150px-basis items. Item 2 has flex-shrink: 2, so it shrinks twice as much as items 1 and 3:
Item 1Item 2Item 3
Hands-On
Examples Gallery
In this example, we’ll demonstrate how the flex-shrink property affects flex items when the flex container is too small to fit all items — plus fixed sidebars, toolbars, and card rows.
📉 Proportional Shrinking
Start with the reference example — different shrink factors when the container is too narrow.
Example 1 — Proportional Shrink Factors
Item 2 shrinks twice as much as items 1 and 3 when the 300px container cannot fit every item at full width.
The middle card uses a higher shrink factor (2) in the flex shorthand, so it compresses more than the side cards when the row is squeezed.
A11y
♿ Accessibility
Do not shrink interactive targets too small — buttons and links need enough tap area on mobile.
Pair shrinking with text overflow — use text-overflow: ellipsis so truncated labels remain understandable.
Test at narrow viewports — ensure critical content is still reachable after items shrink.
Use semantic structure — shrinking is visual; keep logical DOM order for screen readers.
Set min-width on inputs so form fields do not become unusably narrow.
🧠 How flex-shrink Works
1
Container is too small
After flex-basis and content sizes are calculated, the items overflow along the main axis.
Negative free space
2
Shrink factors are summed
Only items with flex-shrink greater than 0 participate in removing overflow space.
Ratios
3
Space is removed proportionally
Each item loses a share proportional to its shrink factor relative to the total.
Distribution
=
📉
Flexible responsive layout
Items compress gracefully on small screens without horizontal scroll or broken layouts.
Compatibility
🖥 Browser Compatibility
The flex-shrink property is supported in all modern browsers, including Chrome, Firefox, Safari, Edge, and Opera. It is widely used and considered stable for production environments.
✓ Baseline · Universal support
flex-shrink everywhere
All shrink factor values work consistently in every modern browser as part of standard Flexbox.
99%Universal support
Google Chrome29+ · Desktop & Mobile
Full support
Mozilla Firefox28+ · Desktop & Mobile
Full support
Apple Safari9+ · macOS & iOS
Full support
Microsoft Edge12+ · All versions
Full support
Opera17+ · Modern versions
Full support
flex-shrink property99% supported
Bottom line:flex-shrink is safe for all modern projects. Combine with flex-grow and flex-basis for full control.
Wrap Up
🎉 Conclusion
The flex-shrink property is a powerful tool for controlling the layout behavior of flex items within a flex container. By adjusting the shrink factor, you can create flexible and responsive designs that adapt to different screen sizes and container widths.
Experiment with different flex-shrink values to see how they affect the distribution of space in your flex layouts. For beginners, remember: default is 1, use 0 to lock an item, and higher numbers mean more shrinking.
Use flex-shrink: 0 on logos, icons, and fixed sidebars
Combine with flex-grow and flex-basis for predictable sizing
Use proportional values (1, 2, 3) when items should shrink unequally
Set min-width: 0 on flex items that need to shrink below content size
Prefer the flex shorthand when setting all three values together
❌ Don’t
Apply flex-shrink on the flex container instead of its children
Treat shrink values as percentages — they are ratios
Expect shrinking when the container has enough space
Shrink buttons or links so small they become hard to tap
Forget that items with flex-shrink: 0 never give up space voluntarily
Summary
Key Takeaways
Knowledge Unlocked
Five things to remember about flex-shrink
Use these points when items must compress in tight layouts.
5
Core concepts
📉01
Shrink factor
Unitless number.
Purpose
102
Default 1
Items shrink.
Default
📊03
Proportional
Ratios, not %.
Key rule
004
flex-shrink: 0
Lock item size.
Pattern
🛠05
Main axis
Overflow only.
Behavior
❓ Frequently Asked Questions
The flex-shrink property defines how much a flex item should shrink relative to other items when the flex container is too small along the main axis and items overflow their allotted space.
The default value is 1, which means flex items will shrink proportionally when the container does not have enough room for their combined sizes.
An item with flex-shrink: 2 gives up twice as much space as an item with flex-shrink: 1 when the container needs to shrink its children. The values are proportional ratios, not percentages.
No. flex-shrink applies to flex items (children), not the flex container itself. The parent needs display: flex or display: inline-flex.
flex-shrink only controls shrinking. The flex shorthand can set flex-grow, flex-shrink, and flex-basis together in one declaration, such as flex: 1 1 auto.