Skip to content Skip to sidebar Skip to footer

Override Parent Style If Child Element Exists

I want to overwrite parent's z-index for every child element containing a specific class. There are two different class of children (w/c I can't change since it's generated by API)

Solution 1:

No, this is unfortunately not possible with CSS3. This is because CSS3 lacks a parent selector.

It should be noted that this will become possible in CSS4, through dint of the :has pseudo-class, where you would be able to target #info when it contains a label with:

div#info:has(div.label)

Post a Comment for "Override Parent Style If Child Element Exists"