coderef

min-content and max-contentBaseline · Widely available

The min-content and max-content CSS keywords represent the smallest and largest intrinsic sizes of an element.

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

Browser support

DesktopChrome
1–45Not supported
46+Supportedsince Oct 13, 2015
Current: 155
Edge
12–18Not supported
79+Supportedsince Jan 15, 2020
Current: 154
Firefox
1–65Not supported
66+Supportedsince Mar 19, 2019
Current: 157
Safari
1–10.1Not supported
11+Supportedsince Sep 19, 2017
Current: 27
MobileChrome Android
18–45Not supported
46+Supportedsince Oct 14, 2015
Current: 155
Firefox Android
4–65Not supported
66+Supportedsince Mar 19, 2019
Current: 157
Safari iOS
1–10.3Not supported
11+Supportedsince Sep 19, 2017
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: max-content.

Feature detection

CSS · check before using
@supports (max-height: min-content) {
  /* styles that rely on max-height: min-content */
}

/* or in JavaScript */
if (CSS.supports("max-height", "min-content")) {
  // use it
}

Sub-features

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

Sub-featureChromeEdgeFirefoxSafariChrome AndroidFirefox AndroidSafari iOS
height.max-content46796611466611
height.min-content46796611466611
max-height.max-content46796611466611
max-height.min-content46796611466611
max-width.max-content46796611466611
max-width.min-content46796611466611
min-height.max-content46796611466611
min-height.min-content46796611466611
min-width.max-content46796611466611
min-width.min-content46796611466611
width.max-content46796611466611
width.min-content46796611466611