min() CSS Function
Description
The min() CSS function allows you to select the smallest value from a list of comma-separated expressions. It is particularly useful for creating responsive designs where you want a property to adapt dynamically but never exceed a certain value. The function can accept any combination of lengths, percentages, numbers, or even other CSS functions such as clamp() and max().
When applied, min() evaluates each value and applies the one that is numerically the smallest. This makes it ideal for situations where you want to constrain a property without using media queries. It works with various CSS properties, such as font-size, width, height, and margin.
Example 1: Responsive font size
p {
font-size: min(4vw, 18px);
}
In this example, the paragraph text will scale with the viewport width, but it will never exceed 18px.
Example 2: Constraining a container
div.container {
width: min(90%, 1200px);
}
Here, the container will take up 90% of the parent element’s width but will not grow larger than 1200px. This is particularly helpful when combined with div layouts in responsive designs.
Example 3: Combining with other functions
h1 {
font-size: min(clamp(16px, 5vw, 40px), 36px);
}
This sets the heading size to the smaller of two values: a dynamically clamped range or a fixed maximum of 36px.
The min() function is widely supported in modern browsers and provides a clean, declarative way to manage responsive sizing without relying heavily on media queries.
Syntax
min() = min( value1, value2, ... )
Values
- value1, value2, ...A list of comma-separated values - where the lowest value is chosen. Required.
Example
Browser Support
The following information will show you the current browser support for the CSS min() function. Hover over a browser icon to see the version that first introduced support for this CSS function.
This function is supported by all modern browsers.
Desktop
Tablets & Mobile
Last updated by CSSPortal on: 31st December 2025
