Impossible in your markup.
CSS selectors can only look at the ancestor and on the axis of siblings. You cannot look inside ("that I have children") - only up ("that there are my parents") and sideways ("that is next to me").
Examples. It:
div.header div.menu
refers to any <div class="menu"> whose ancestors are <div class="header"> .
It:
div.header > div.menu
refers to any <div class="menu"> whose direct ancestor (ie, "parent") is <div class="header"> .
It:
div.header ~ div.menu
refers to any <div class="menu"> that has <div class="header"> among its previous siblings, i.e. they have the same parent element and occur one after another, but not necessarily adjacent to each other (which "looks sideways").
It:
div.header + div.menu
refers to any <div class="menu"> whose direct predecessor sibling is <div class="header"> .
There are no other move selectors in CSS (this statement applies to CSS2) and, of course, there are no conditional expressions.
Tomalak
source share