CSS min-width / max-width Property Explained
What the CSS min-width / max-width property does, with an example.
Published November 7, 2026
min-width and max-width set lower and upper limits on an element's width, letting it be fluid but never too narrow or too wide. They override width when they conflict.
How it works
max-width: 100% makes images responsive. A centred max-width container is the basis of readable page layouts.
min-width: 0 on flex items fixes overflow of long content.
Values and effects
min-width / max-width: max-width: 100%; → never exceed parent
min-width / max-width: max-width: 65ch; → readable line length
min-width / max-width: min-width: 0; → allow shrinking
Practical examples
Responsive image
img { max-width: 100%; height: auto; }Readable article
article { max-width: 65ch; margin-inline: auto; }Flex overflow fix
.flex-child { min-width: 0; }Common mistakes
- Setting a fixed width on mobile that overflows.
- Forgetting min-width: 0 on flex items.
- Using max-width with padding without box-sizing.
Key takeaways
- min-width / max-width in one line: min-width and max-width set lower and upper limits on an element's width, letting it be fluid but never too narrow or too wide.
- Inspect it live in DevTools → Styles.
- Test across browsers and screen sizes.
FAQ
Which wins: width or max-width?
max-width wins; min-width wins over both.
Is min-width / max-width supported in all browsers?
Yes in all modern browsers; check caniuse.com for edge cases.