CKTIS / CSS
cqh — container height unit
The cqh unit expresses lengths relative to an eligible container’s height rather than directly relative to the browser viewport.
Version: CSS modules; structured CSSWG indexes reconciled with pinned MDN BCD; Chromium 152 scope gate, per-example verification still required
Syntax
<number>cqh1cqh is 1% of the physical height of the nearest ancestor accepting size queries on that axis. This need not be the direct parent; an element is not its own reference container.
Use container-type: size and give the container a definite height. With writing-mode: horizontal-tb, container-type: inline-size alone does not qualify for the height axis. Without an eligible ancestor, cqh uses the small viewport height, like svh.
cqh follows physical height, whereas cqb follows logical block size. No @container rule is required.
In the example, 25cqh is expected to produce 50px because the container is 200px tall. Changing that height to 400px should produce 100px.
Examples
<!doctype html>
<html lang="en">
<meta charset="utf-8">
<title>cqh example</title>
<style>
.container {
container-type: size;
width: 240px;
height: 200px;
background: #eee;
}
.item {
width: 100px;
height: 25cqh;
background: #1769aa;
}
</style>
<div class="container">
<div class="item"></div>
</div>
</html>Result
.container: 240px × 200px .item: 100px × 50px
The displayed code and declared result were verified in an isolated environment using the method recorded in the verification evidence for this exact version.