coderef

min(), max(), and clamp()Baseline · Widely available

The min() and max() CSS functions return the minimum or maximum of the arguments, while clamp() clamps a value to a given range.

Supported in all major browsers for at least 30 months — safe to use without fallbacks. Baseline since Jul 28, 2020. Widely available since Jan 28, 2023.

Browser support

DesktopChrome
1–78Not supported
79+Supportedsince Dec 10, 2019
Current: 155
Edge
12–18Not supported
79+Supportedsince Jan 15, 2020
Current: 154
Firefox
1–74Not supported
75+Supportedsince Apr 7, 2020
Current: 157
Safari
1–13Not supported
13.1+Supportedsince Mar 24, 2020
Current: 27
MobileChrome Android
18–78Not supported
79+Supportedsince Dec 17, 2019
Current: 155
Firefox Android
4–68Not supported
79+Supportedsince Jul 28, 2020
Current: 157
Safari iOS
1–13Not supported
13.4+Supportedsince Mar 24, 2020
Current: 27

How to use

This feature is Baseline widely available — use it freely, no fallback needed.

Example

Full syntax and examples are on MDN: clamp.

Feature detection

CSS · check before using
@supports (width: clamp(1px, 2px, 3px)) {
  /* styles that use clamp */
}

/* or in JavaScript */
if (CSS.supports("width", "clamp(1px, 2px, 3px)")) {
  // use it
}

Sub-features

Support for each part of the feature (3). The overall table above shows when the whole feature works.

Sub-featureChromeEdgeFirefoxSafariChrome AndroidFirefox AndroidSafari iOS
<clamp>79797513.1797913.4
<max>79797511.1797911.3
<min>79797511.1797911.3