Knowledge baseExam Center
ENEnglish
Choose language13

CKTIS / CSS

vmin — the smaller viewport dimension unit

The vmin length unit equals 1% of the smaller dimension of the large viewport. It scales an element against the page viewport’s width and height, not its parent.

Version: CSS modules; structured CSSWG indexes reconciled with pinned MDN BCD; Chromium 152 scope gate, per-example verification still required

Syntax

<number>vmin

vmin is a relative length unit: 1vmin is the smaller of 1vw and 1vh. Write the number directly before the unit, without a space, for example 50vmin. The parent element’s size is not the reference.

vmin is equivalent to lvmin: it uses the large viewport, which assumes retractable browser interface elements are hidden. On mobile devices, the visible area can be smaller. svmin uses the small viewport, while dvmin uses the dynamic viewport.

The example creates a square with sides of 50vmin. For a viewport of 800 × 600 or 600 × 800 CSS pixels, each side is 300px long.

Examples

<!doctype html>
<html lang="en">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>vmin example</title>
<style>
  body { margin: 0; }
  .box {
    width: 50vmin;
    height: 50vmin;
    background: teal;
  }
</style>
<div class="box"></div>
</html>

Result

800 × 600 CSS px viewport: 300 × 300 CSS px square.
600 × 800 CSS px viewport: 300 × 300 CSS px 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.

Sources