I am facing an issue with applying a default background color to #parent
in HTML when it contains a #child
.
<div id="parent">
<div id="child"></div>
</div>
Even though I tried using the CSS code below, the :contains
pseudo selector is not working as expected:
#parent {
background: red
}
#parent:contains(#child) {
background: none
}
Is there a different method or workaround to achieve this functionality?