Automatic minimum sizes
Definition and purpose
Flex items may resist shrinking because the automatic main-axis minimum can depend on intrinsic content size. An unbreakable label or fixed-size descendant can force a row to overflow even when flex-shrink is positive.
Intrinsic obstruction
<!doctype html><html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>CSS practice</title> <style> body { margin: 0; } #p { width: 300px; } #p > div { background: lightblue; outline: 1px solid navy; } #p { display: flex; } #a { flex: 1 1 0px; } #a span { display: block; width: 260px; } #b { flex: 0 0 100px; } </style> </head> <body> <div id="p"> <div id="a"> <span>Wide content</span> </div> <div id="b">Tools</div> </div> </body></html>The 260px descendant prevents A from shrinking to the available 200px.
Syntax and mental model
For a horizontal row, min-width: 0 (or logical min-inline-size: 0 in horizontal writing) lets the item shrink below its content-based minimum. Then choose an appropriate content behavior: wrapping, scrolling or clipping. The automatic minimum is not always min-content; scrollable overflow and other sizing constraints affect it.
Allow shrinking and scroll content
<!doctype html><html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>CSS practice</title> <style> body { margin: 0; } #p { width: 300px; } #p > div { background: lightblue; outline: 1px solid navy; } #p { display: flex; } #a { flex: 1 1 0px; min-width: 0; overflow: auto; } #a span { display: block; width: 260px; } #b { flex: 0 0 100px; } </style> </head> <body> <div id="p"> <div id="a"> <span>Wide content</span> </div> <div id="b">Tools</div> </div> </body></html>A fits into 200px and its wide descendant can be scrolled.
Common mistakes
Do not disable shrink just because text overflows. Inspect the minimum and the content separately. Setting a zero minimum alone does not break unbreakable text.
Practice and next steps
After trying the examples, complete the linked coding exercise and review questions. Predict the result before running your code. Prerequisite: Basis, grow and shrink. Next lesson: Auto margins and visual order.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
Automatic minimum sizes — knowledge check
Five questions on automatic minimum sizes.
Why can a flex item refuse to shrink?
In a horizontal flex row, which declaration explicitly permits zero minimum width?
Does zero minimum width itself wrap an unbreakable word?
Which content behavior provides scrolling when needed?
Why inspect the content after shrinking?