Knowledge baseExam Center
ENEnglish
Choose language13

CKTIS / CSS

cqmin — the smaller container unit

The cqmin length unit equals the smaller of 1cqi and 1cqb. It lets dimensions scale relative to containers rather than only relative to the viewport.

Version: CSS modules; structured CSSWG indexes reconciled with pinned MDN BCD; Chromium 152 scope gate; example verification recorded, browser execution not explicitly documented

Syntax

<number>cqmin

cqmin is a relative length unit: 1cqmin = min(1cqi, 1cqb). cqi represents 1% of the container’s inline size, and cqb represents 1% of its block size.

Each axis selects its nearest eligible ancestor; these may be different containers. Without an eligible container, that axis uses the small viewport size. container-type: inline-size alone does not provide a container for both axes.

The example uses container-type: size and explicit dimensions to provide both axes. The expected result is a teal square measuring 20px × 20px. To check how it renders in your target browser, open the example there.

Examples

<!doctype html>
<meta charset="utf-8">
<title>cqmin</title>
<style>
  .container {
    container-type: size;
    width: 400px;
    height: 200px;
    writing-mode: horizontal-tb;
  }
  .square {
    width: 10cqmin;
    height: 10cqmin;
    background: teal;
  }
</style>
<div class="container">
  <div class="square"></div>
</div>

Result

Expected: a teal square measuring 20px × 20px.

The displayed code and expected result were verified for this exact version. The verification record does not specify whether the example was run in a browser.

Sources