Interview Question

What is min-width and max-width?

min-width sets a lower width bound; max-width sets an upper width bound.

💡 Concept ✅ Quick Revision 🎨 CSS

Answer

min-width and max-width constrain an element’s used width. β€’ min-width prevents the used width from becoming smaller than its limit. β€’ max-width prevents the used width from becoming larger than its limit. β€’ When constraints conflict, minimum sizing rules take priority according to CSS sizing.

💡 Simple Example

.content { width: 100%; min-width: 16rem; max-width: 70rem; }

⚡ Quick Revision

min-width sets a lower width bound; max-width sets an upper width bound.