CKTIS / CSS
cqi — container-relative inline-size unit
The cqi unit represents 1% of a container’s inline size. It lets elements scale relative to their container rather than the entire viewport.
Version: CSS modules; structured CSSWG indexes reconciled with pinned MDN BCD; Chromium 152 scope gate, per-example verification still required
Syntax
<number>cqicqi is a length unit: 1cqi is 1% of the inline size of the nearest ancestor supporting size queries on that axis. Write the number directly before the unit, for example 25cqi.
Set container-type: inline-size on an ancestor. An @container rule is not required. An element cannot be its own reference container. Without an eligible ancestor, the reference is the small viewport size on that axis.
The inline axis depends on writing mode: it is usually horizontal but can be vertical. Therefore, cqi does not always match cqw, which references width.
In the example, the container’s inline size is 400px, so 25cqi gives 100px.
Examples
<!doctype html>
<meta charset="utf-8">
<title>cqi</title>
<style>
.container {
container-type: inline-size;
writing-mode: horizontal-tb;
inline-size: 400px;
}
.bar {
inline-size: 25cqi;
block-size: 20px;
background: teal;
}
</style>
<div class="container">
<div class="bar"></div>
</div>Result
.bar: inline-size = 100px; block-size = 20px
The displayed code and declared result were verified in an isolated environment using the method recorded in the verification evidence for this exact version.