Knowledge baseExam Center
ENEnglish
Choose language13

CKTIS / CSS

contain-intrinsic-block-size

Specifies a substitute inner size along the block axis under size containment, without deriving that size from descendants.

Version: CSS modules; structured CSSWG indexes reconciled with pinned MDN BCD; Chromium 152 scope gate, per-example verification still required

Syntax

contain-intrinsic-block-size: auto? [ none | <length [0,∞]> ];

contain-intrinsic-block-size specifies a substitute inner block-axis size: height in horizontal-tb, width in vertical writing modes. It is not equivalent to block-size.

none supplies no explicit substitute size. Lengths must be nonnegative; percentages are invalid. Optional auto precedes none or a length: while contents are skipped, it uses the last remembered size if available; otherwise the supplied fallback applies. The initial value is none; the property is not inherited.

The property does not enable size containment itself. The example uses contain: size to give an empty element a substitute height. With content-visibility: auto, a remembered size can replace the estimate while off-screen contents are skipped. Inaccurate estimates can cause layout shifts.

Examples

<!doctype html>
<meta charset="utf-8">
<title>Intrinsic block size</title>
<style>
  #box {
    writing-mode: horizontal-tb;
    contain: size;
    contain-intrinsic-block-size: 120px;
    inline-size: 200px;
    padding: 0;
    border: 0;
    background: lightblue;
  }
</style>
<div id="box"></div>
<pre id="result"></pre>
<script>
  const box = document.getElementById('box');
  document.getElementById('result').textContent =
    getComputedStyle(box).blockSize;
</script>

Result

120px

The displayed code and declared result were verified in an isolated environment using the method recorded in the verification evidence for this exact version.

Sources