Loading

Quipoin Menu

Learn • Practice • Grow

css / CSS Max-Width
interview

Q1. What does max-width do?
max-width sets the maximum width an element can stretch to. It can shrink smaller but not exceed this value.

Q2. What is the difference between width and max-width?
width sets a fixed width, max-width sets an upper limit allowing flexibility. When max-width is less than width, max-width wins.

Q3. How is max-width used in responsive design?
Set max-width: 100% on images to ensure they never exceed container width, making them responsive.

Q4. What is the default value of max-width?
Default is none, meaning no maximum width constraint.

Q5. How do you center an element with max-width?
Set a max-width and use margin: 0 auto; The element will be centered as long as it's block-level.