CSS min() Function
Example
.example1 {
width: min(20%, 100px);
}
.example2 {
width: min(20%, 200px);
}
.example3 {
width: min(50%, 400px);
}
Meaning
The min() css function uses the smallest (most negative) value from a list of comma-separated expressions as the value of a CSS property value.
It can combine min() and max() values, or use min() within a clamp() or calc() function.
It can accept more than two arguments, if you have multiple constraints to apply.
The expression can be values combining the addition ( + ), subtraction ( - ), multiplication ( * ) and division ( / ) operators, using standard operator precedence rules.
Version: CSS3
Standard Syntax
min(value1, value2, ...)
Browser Support
The numbers in the table specify the first browser version that fully supports the property.
Status
Function Arguments
The following table describes the arguments of this function.
Argument | Description |
---|---|
value1, value2, ... | Specifies one or more comma-separated expressions as its parameter, with the smallest (most negative) expression value result used as the value. |