Knowledge baseExam Center
ENEnglish
Choose language13

CKTIS / CSS

height — CSS property

`height` sets the physical height of the box.

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

Syntax

auto | <length-percentage [0,∞]> | min-content | max-content | fit-content | fit-content(<length-percentage [0,∞]>) | <calc-size()> | <anchor-size()>

height sets the physical height of the box.

The example measures the border box after applying the value, exposing the physical or logical axis rather than merely parser support.

The accepted grammar is auto | <length-percentage [0,∞]> | min-content | max-content | fit-content | fit-content(<length-percentage [0,∞]>) | <calc-size()> | <anchor-size()>; global values still participate in the cascade.

box-sizing changes what the number includes, and logical properties follow writing-mode.

Examples

<!doctype html>
<html lang="en"><meta charset="utf-8"><title>CKTIS CSS reference example</title>
<body><div class="probe">probe</div><pre id="result"></pre><script>
const x=document.querySelector(".probe");x.style.cssText="box-sizing:border-box;height:48px;width:20px";document.querySelector("#result").textContent="box-height="+Math.round(x.getBoundingClientRect().height)+"; computed="+getComputedStyle(x).height;
</script></body></html>

Result

box-height=48; computed=48px

The example was executed locally in an isolated, network-free Chrome session; the result comes from the browser CSS API.

Sources