Is it possible to set a parent element style from a child style?
<div id="main"> <div id="sub"> </div> </div> Is it possible to set the basic style from the subscript style?
+6
Jeaf gilbert
source share3 answers
Cascading style sheets only go (cascade) down, so they are not designed for this at all ... even in those rare cases it would be very convenient if they did.
You need either JavaScript, or a line style, or another layout to get the style you follow after ... but pure CSS affecting the parent is not an option.
+10
Nick craver
source shareThis is possible with Javascript, but not with pure CSS.
0
fredley
source shareUsing CSS4 selectors, the original question can be resolved as follows:
li! > a.active { /* styles to apply to the li tag */ } 0
adel
source share