I am currently struggling with container queries. As long as I just use min-width and max-width everything is fine and works well. As soon as I try to use logic operators like and/or it doesn´t work anymore.
.wrapper {
width: 300px;
container-name: wrapper;
container-type: inline-size;
}
.box {
background-color: #0000ff;
color: #ffffff;
width: 100px;
display: flex;
align-items: center;
justify-content: center;
}
@container wrapper (min-width: 300px) {
.box {
background-color: #00ff00;
}
}
@container wrapper (min-width: 300px) and (min-height: 0px) {
.box {
background-color: #ff0000;
}
}
<div class="wrapper">
<div class="box">
<span>test</span>
</div>
</div>
See the codepen here: https://codepen.io/Resolver1412/pen/dygxWKY
I would expect that the box would become red instead of green. Since the last container query would overwrite the previous one.
Anyone knows whats wrong or what might have happened? I currently use this chrome version: Version 112.0.5615.121