<max>
Widely availableSince 202097% of users
Returns the largest (most positive) value from a list of comma-separated expressions. It is useful for creating layouts that grow but don't shrink below a certain point.
What's modern
From web-features, MDN's browser data and our snippets, checked dailyModernIn every major browser since July 2020. Widely available since January 2023.
The old way and the modern waySee the snippet: Fluid typography without media queries →
Old way 13 lines
h1 {
font-size: 1rem;
}
@media (min-width: 600px) {
h1 {
font-size: 1.5rem;
}
}
@media (min-width: 900px) {
h1 {
font-size: 2rem;
}
}Modern 3 lines
h1 {
font-size: clamp(1rem, 0.5rem + 2.5vw, 2rem);
}See how modern your own CSS is.Check your CSS →
Quick example
.flexible-box {
/* Stays at 300px unless the screen is very small, then it uses 50vw */
width: max(50vw, 300px);
}<max> browser support
BaselineWidely availableThis feature is well established and works across many devices and browser versions. It has been available across browsers since 2020.Safe to use without fallbacks.
Usage97%of people can use this3% use a browser without it.
Browsers
79+
75+
11.1+
79+Mobile
79+Android
79+Android
11.3+iOS