CKTIS / CSS
cqw — container width unit
The cqw unit represents 1% of the width of the nearest eligible query container, which is not necessarily the parent.
Version: CSS modules; structured CSSWG indexes reconciled with pinned MDN BCD; Chromium 152 scope gate, per-example verification still required
Syntax
<number>cqwcqw is a length unit: 1cqw is 1% of the width of the nearest ancestor supporting size queries on that axis. The element itself is not its own reference container.
Width is physical; cqi instead follows the logical inline axis. With writing-mode: horizontal-tb, setting container-type: inline-size exposes width to descendants. An @container rule is not required.
Without an eligible ancestor, cqw uses the small viewport width, like svw. It does not become zero or use an ordinary parent's width.
Examples
<!doctype html>
<meta charset="utf-8">
<title>cqw example</title>
<style>
.container {
writing-mode: horizontal-tb;
container-type: inline-size;
width: 400px;
}
.bar {
width: 25cqw;
height: 20px;
background: teal;
}
</style>
<div class="container">
<div class="bar"></div>
</div>
<script>
const bar = document.querySelector('.bar');
console.log(getComputedStyle(bar).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.