CKTIS / CSS
contain-intrinsic-inline-size — a substitute intrinsic inline size
contain-intrinsic-inline-size supplies a substitute intrinsic size along the inline axis when sizing is contained independently of content.
Version: CSS modules; structured CSSWG indexes reconciled with pinned MDN BCD; Chromium 152 scope gate, per-example verification still required
Syntax
contain-intrinsic-inline-size: auto? [ none | <length [0,∞]> ];contain-intrinsic-inline-size supplies a substitute content size for an inline axis subject to size containment. This axis corresponds to width in horizontal-tb and height in vertical writing modes.
The value is none or a nonnegative length, optionally preceded by auto; percentages are invalid. The initial none means no substitute size. The property is not inherited. auto uses the last remembered size only while contents are being skipped; otherwise, the supplied none or length applies.
The property does not enable containment itself. contain: inline-size makes sizing in that axis independent of content without hiding it. In the example, inline-size: max-content uses the substitute size. This is not equivalent to setting a fixed inline-size; layout constraints still matter.
Examples
<!doctype html>
<meta charset="utf-8">
<title>Intrinsic inline size</title>
<style>
#box {
writing-mode: horizontal-tb;
contain: inline-size;
contain-intrinsic-inline-size: 240px;
inline-size: max-content;
padding: 0;
border: 0;
background: lightblue;
}
</style>
<div id="box">Short content</div>
<pre id="result"></pre>
<script>
const box = document.getElementById('box');
document.getElementById('result').textContent =
`${box.getBoundingClientRect().width}px`;
</script>Result
240px
The displayed code and declared result were verified in an isolated environment using the method recorded in the verification evidence for this exact version.