Let's say I have some HTML set up like this:
<div class="older-sibling">
<div class="first-child">
<div class="first-grandchild"></div>
</div>
<div class="second-child">
<div class="second-grandchild"></div>
</div>
<div class="third-child">
<div class="third-grandchild"></div>
</div>
</div>
<div class="younger-sibling"></div>
The divs .first-child and .third-child will always be present. The div .second-child, however, may not be. When the .second-child div of the .older-sibling is not present, I can target the css rules of the .third-grandchild div by checking to see if its parent is the adjacent sibling of the .first-child, like so:
.first-child + .third-child > .third-grandchild {
rule: foo;
}
In those cases where the .second-child is not present, I also want to apply some conditional css targeted at the .younger-sibling div. How can I achieve this using CSS and without having to incorporate jQuery?