Hello, is there any way to select the parent element of another element with CSS?
To be more specific, I am studying in localhost using the phpBB3 forums platform, when a message is grateful it gains the .bg1
class (the default being .bg2
).
Both .bg1
and bg2
are direct children of class .pannels
, since this does not change if the message is grateful or not.
My goal is to style the .pannels
class with a background-color:#eaf8e2
only if its child element is .bg1
if it is .bg2
would like to keep the #fff
color in the background.
<div class="pannels">
<div class="bg1"></div>
</div>
<div class="pannels">
<div class="bg2"></div>
</div>