coderef

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: 155
Edge
12–15Not supported
16+Supportedsince Oct 17, 2017
Current: 154
Firefox
1–18Not supported
19+Supportedsince Feb 19, 2013
Current: 157
Safari
1–6Not supported
7+Supportedsince Oct 22, 2013
Current: 27
MobileChrome Android
18–25Not supported
26+Supportedsince Apr 3, 2013
Current: 155
Firefox Android
4–18Not supported
19+Supportedsince Feb 19, 2013
Current: 157
Safari iOS
1–6Not supported
7+Supportedsince Sep 18, 2013
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 — 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.

Sub-features

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

Sub-featureChromeEdgeFirefoxSafariChrome AndroidFirefox AndroidSafari iOS
<length>.vh201219625196
<length>.vmax261619726197
<length>.vmin261219726197
<length>.vw201219625196