My guess is this a browser issue!
But its interesting
Below I have 2 variation of calculating height and assigning it.
The Black box is using css variable and to calculate and assign the height of the box.
:root {
--content-height: calc(var(--app-height) - var(--app-footer) - var(--app-footer));
}
.black {
height: var(--content-height);
}
The Blue box is assigned height without using css variable and it works, while the black doesn't work
.blue {
height: calc(var(--app-height) - var(--app-footer) - var(--app-footer))
}
Guess both will work in same way? NO
https://codepen.io/Anenth/pen/VVwpzp
Only the second one works fine! Checkout the below code
document.querySelector('body').style.setProperty('--app-height', "100px")
:root {
--app-header: 20px;
--app-footer: 20px;
--app-height: 300px;
--content-height: calc(var(--app-height) - var(--app-footer) - var(--app-footer));
}
.box {
width: 50px;
background: #000;
margin: 20px;
display:inline-block;
vertical-align:top;
}
.box-with-calc-var {
height: var(--content-height);
}
.box-without-calc-var {
background: #00F;
height: calc(var(--app-height) - var(--app-footer) - var(--app-footer));
}
<div class="box box-with-calc-var"></div>
<div class="box box-without-calc-var"></div>
--content-heightwas really defined at the same level of your element, both will work the same : jsfiddle.net/8xfrdv62--content-heightis defined a root level but if you check your explanation before the snippet where you defined.black, you defined the variable there at the same level of height definition which is different from defining at root level (like explained in the duplicate and like shown in the fiddle I shared)