0
0
CSSmarkup~5 mins

Min and max functions in CSS - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What does the CSS min() function do?
The min() function takes multiple values and uses the smallest one. It helps make layouts responsive by choosing the minimum size from given options.
Click to reveal answer
beginner
How does the CSS max() function work?
The max() function picks the largest value from the list of values you provide. It ensures elements don’t get smaller than a certain size.
Click to reveal answer
beginner
Give an example of using min() in CSS.
Example: width: min(50vw, 300px); means the width will be the smaller of 50% of the viewport width or 300 pixels.
Click to reveal answer
intermediate
Why use min() and max() instead of fixed sizes?
They help create flexible layouts that adapt to screen size. This improves user experience on phones, tablets, and desktops.
Click to reveal answer
intermediate
Can min() and max() accept different units?
Yes! You can mix units like px, em, vw, etc. The browser compares them and picks the smallest or largest value.
Click to reveal answer
What will width: min(100px, 50vw); do on a small screen?
ASet width to 50vw
BSet width to 100px
CSet width to the larger of 100px or 50vw
DCause an error
Which CSS function picks the largest value?
Amin()
Bclamp()
Cmax()
Dcalc()
Can min() and max() be used together?
AYes, for example inside <code>clamp()</code>
BOnly in JavaScript
CNo, only one can be used at a time
DOnly with fixed pixel values
What units can you use inside min() and max()?
AAny CSS length units like px, em, rem, vw
BOnly percentages (%)
COnly pixels (px)
DOnly viewport units (vw, vh)
Why are min() and max() useful for responsive design?
AThey fix sizes so they never change
BThey replace media queries
CThey only work on desktop screens
DThey allow sizes to adapt between limits
Explain how the CSS min() function helps create responsive layouts.
Think about how choosing the smallest size can keep things neat on small screens.
You got /4 concepts.
    Describe a scenario where using max() in CSS is helpful.
    Consider when text or buttons should not become too small.
    You got /4 concepts.