CKTIS / CSS
cqmax — the larger container-relative unit
The cqmax length unit selects the larger of 1cqi and 1cqb. It scales an element relative to container dimensions, with a container selected independently for each axis.
Version: CSS modules; structured CSSWG indexes reconciled with pinned MDN BCD; Chromium 152 scope gate, per-example verification still required
Syntax
<number>cqmaxcqmax is a length unit: 1cqmax = max(1cqi, 1cqb). The cqi and cqb units represent 1% of a container’s inline and block sizes, respectively. By contrast, cqmin selects the smaller value.
Each axis uses the nearest ancestor that supports size queries on that axis. The axes can therefore use different containers. If no suitable container exists, that axis uses the small viewport size instead.
The example uses container-type: size and explicit dimensions of 400px × 200px. The expected width of .sample is 100px: 25 × max(4px, 2px). Running the example in an isolated environment with Chromium 157.0.8103.51 confirmed that the page’s body text was 100px. To check the result in your target browser, save the example as an HTML file and open it there.
Examples
<!doctype html>
<meta charset="utf-8">
<title>cqmax</title>
<style>
.container {
container-type: size;
writing-mode: horizontal-tb;
width: 400px;
height: 200px;
}
.sample {
width: 25cqmax;
height: 20px;
background: teal;
}
</style>
<div class="container">
<div class="sample"></div>
</div>
<pre id="result"></pre>
<script>
const sample = document.querySelector('.sample');
document.querySelector('#result').textContent =
getComputedStyle(sample).width;
</script>Result
100px
The displayed code and declared result were verified in an isolated environment using the method recorded in the verification evidence for this exact version.