tags:

views:

29

answers:

2
<div id="main">
    <div id="sub">
    </div>
</div>

Can I set main's style from sub's style?

A: 

This would be possible with Javascript, but not with pure CSS.

fredley
+5  A: 

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.

Nick Craver