26
Hello, is there any way to select the parent element of another element with CSS?
To be more specific, I’m studying on localhost using the phpBB3 forum platform, when a message is thankful it wins the class .bg1
(where the standard is .bg2
).
Both .bg1
and bg2
are direct children of the .pannels
, but this does not change whether the message is grateful or not.
My goal is to style the class .pannels
with a background-color:#eaf8e2
only if her child element is .bg1
if it is the .bg2
would like to keep the color #fff
in the background.
<div class="pannels">
<div class="bg1"></div>
</div>
<div class="pannels">
<div class="bg2"></div>
</div>
Why don’t you do it using jquery?
– Paulo
I’ll be using friend.. I just wondered if there was any way to do this in CSS before using jQuery...
– Wagner'