object-fitBaseline · Widely available
The object-fit CSS property sets how images, videos, and other replaced elements are scaled within their container.
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–31Not supported
32+Supportedsince Jan 14, 2014
Current: 155Edge
12–18Not supported
79+Supportedsince Jan 15, 2020
Current: 154Firefox
1–35Not supported
36+Supportedsince Feb 24, 2015
Current: 157Safari
1–9.1Not supported
10+Supportedsince Sep 20, 2016
Current: 27MobileChrome Android
18–31Not supported
32+Supportedsince Jan 15, 2014
Current: 155Firefox Android
4–35Not supported
36+Supportedsince Feb 27, 2015
Current: 157Safari iOS
1–9.3Not supported
10+Supportedsince Sep 13, 2016
Current: 27How to use
This feature is Baseline widely available — use it freely, no fallback needed.
Example
Full syntax and examples are on MDN: object-fit.
Feature detection
CSS · check before using
@supports (object-fit: initial) {
/* styles that rely on object-fit */
}
/* or in JavaScript */
if (CSS.supports("object-fit", "initial")) {
// use it
}Documentation (MDN)
Specification
Usage share
Sub-features
Support for each part of the feature (6). The overall table above shows when the whole feature works.
| Sub-feature | Chrome | Edge | Firefox | Safari | Chrome Android | Firefox Android | Safari iOS |
|---|---|---|---|---|---|---|---|
| object-fit | 32 | 79 | 36 | 10 | 32 | 36 | 10 |
| object-fit.contain | 32 | 79 | 36 | 10 | 32 | 36 | 10 |
| object-fit.cover | 32 | 79 | 36 | 10 | 32 | 36 | 10 |
| object-fit.fill | 32 | 79 | 36 | 10 | 32 | 36 | 10 |
| object-fit.none | 32 | 79 | 36 | 10 | 32 | 36 | 10 |
| object-fit.scale-down | 32 | 79 | 36 | 10 | 32 | 36 | 10 |