Reputation: 11981
<div id="main">
<div id="sub">
</div>
</div>
Can I set main's style from sub's style?
Upvotes: 6
Views: 7268
Reputation: 1
Using CSS4 selectors, the original question could be solved with this:
li! > a.active { /* styles to apply to the li tag */ }
Upvotes: 0
Reputation: 630349
Cascading Stylesheets only go (cascade) down, so they're not designed to do this at all...even in those rare cases it would be very handy if they did.
You need either JavaScript, in-line style or a different layout to get the stying you're after...but pure CSS affecting the parent isn't an option here unfortunately.
Upvotes: 10