CKTIS / CSS
vmax — larger viewport dimension unit
The vmax length unit equals 1% of the larger dimension of the large viewport: its width or height. It scales an element relative to the longer axis, regardless of orientation.
Version: CSS modules; structured CSSWG indexes reconciled with pinned MDN BCD; Chromium 152 scope gate, per-example verification required
Syntax
<number>vmaxvmax is a relative CSS length unit. 1vmax is the larger of 1vw and 1vh; 10vmax means ten such units. Write the number directly before the unit, without a space. The reference is not the parent element’s size.
vw refers to width, vh to height, and vmin selects the smaller dimension. vmax selects the larger dimension, so at both 800 × 600 CSS px and 600 × 800 CSS px, 10vmax equals 80 CSS px.
vmax corresponds to lvmax: it uses the large viewport, which assumes retractable browser interfaces are hidden. Visible toolbars can therefore obscure content. svmax uses the small viewport, while dvmax uses the dynamic viewport. vmax does not continuously track toolbar animations, but responds to viewport resizing.
The example creates a teal square with sides of 10vmax. The square measures 80 × 80 CSS px in both specified configurations.
Examples
<!doctype html>
<html lang="en">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>vmax example</title>
<style>
html { overflow: hidden; }
body { margin: 0; }
.box {
width: 10vmax;
height: 10vmax;
background: teal;
}
</style>
<div class="box"></div>
</html>Result
800 × 600 CSS px viewport: 80 × 80 CSS px teal square. 600 × 800 CSS px viewport: 80 × 80 CSS px teal square.
The displayed code and declared result were verified in an isolated environment using the method recorded in the verification evidence for this exact version.