Set different background image dependent on match of child element
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 开发者_Go百科BODY
if template
exists as a child.
I would like to do this purely in CSS, not with any jQuery or anything, thanks.
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.
精彩评论