Looking for a solution to the issue stated in the title, this code snippet is causing some trouble:
.group {
width: 100px;
height: 100px;
background-color: blue;
}
.group:empty {
background-color: red;
}
.hideme {
display: none;
}
<div class="group">
<div class="hideme">
hello
</div>
</div>
It appears that the background color isn't changing to red as expected. Is there an alternative to using :empty
that will also apply the style if any children are set to display: none
?