I have the following CSS:
:root {
--some-number: 0;
}
.header-nav {
container: header-nav-container / size;
}
@container header-nav-container (width < calc(400px + (var(--some-number) * 100px))) {
.header-nav-menu__label {
display: none;
}
}
The code above, and specifically the dynamic width calculation doesn't seem to work as expected. If I replace the calc()
above with simply 400px
the container query works fine, but of course it's not dynamic anymore.
I tested the width calculation separately by setting it on the width property of another element, and the calculation itself seems to work fine, even when the some-number
property increases.
What am I missing? Can we not use calc()
inside container queries?