Viewport unitsBaseline · Widely available
The vw, vh, vmin, and vmax CSS viewport units are relative to the size of the viewport, and are used to size elements in relation to the viewport's dimensions.
Supported in all major browsers for at least 30 months — safe to use without fallbacks. Baseline since Oct 17, 2017. Widely available since Apr 17, 2020.
Browser support
DesktopChrome
1–25Not supported
26+Supportedsince Mar 26, 2013
Current: 155Edge
12–15Not supported
16+Supportedsince Oct 17, 2017
Current: 154Firefox
1–18Not supported
19+Supportedsince Feb 19, 2013
Current: 157Safari
1–6Not supported
7+Supportedsince Oct 22, 2013
Current: 27MobileChrome Android
18–25Not supported
26+Supportedsince Apr 3, 2013
Current: 155Firefox Android
4–18Not supported
19+Supportedsince Feb 19, 2013
Current: 157Safari iOS
1–6Not supported
7+Supportedsince Sep 18, 2013
Current: 27How to use
This feature is Baseline widely available — use it freely, no fallback needed.
Example
Full syntax and examples are on MDN — see the links below.
Feature detection
There’s no simple runtime check for this feature; rely on the support table and test in your target browsers.
Specification
Usage share
Sub-features
Support for each part of the feature (4). The overall table above shows when the whole feature works.
| Sub-feature | Chrome | Edge | Firefox | Safari | Chrome Android | Firefox Android | Safari iOS |
|---|---|---|---|---|---|---|---|
| <length>.vh | 20 | 12 | 19 | 6 | 25 | 19 | 6 |
| <length>.vmax | 26 | 16 | 19 | 7 | 26 | 19 | 7 |
| <length>.vmin | 26 | 12 | 19 | 7 | 26 | 19 | 7 |
| <length>.vw | 20 | 12 | 19 | 6 | 25 | 19 | 6 |