views:

25

answers:

1

Hi there,

Can I set a different background-image CSS attribute to my <BODY> tag depending on successful match of a found child <div class="template" /> element?

I know of the CSS selector BODY>.template but that alters the template class where an immediate parent match of BODY exists, I want to control BODY if template exists as a child.

I would like to do this purely in CSS, not with any jQuery or anything, thanks.

+2  A: 

Unfortunately that's not possible with pure CSS. You can't influence a parent element based on a child element. The Cascading in CSS only goes in one direction. :)

If you can you should add a different id or class to <body> to do this.

deceze
Hey, good idea. Thanks.
GONeale