Is it possible to set the basic st...">

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
css
source share
3 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
source share

This is possible with Javascript, but not with pure CSS.

0
source share

Using CSS4 selectors, the original question can be resolved as follows:

 li! > a.active { /* styles to apply to the li tag */ } 
0
source share

All Articles