I'm trying to select only the divs with class c, that have at least one sibling with class b. Here are some examples:
// Case1
<div class="a">
<div class="b"></div>
<div class="b"></div>
<div class="b"></div>
</div>
// Case2
<div class="a">
<div class="c"></div>
<div class="c"></div>
<div class="c"></div>
</div>
// Case3
<div class="a">
<div class="b"></div>
<div class="c"></div> //this one
<div class="b"></div>
</div>
// Case4
<div class="a">
<div class="c"></div> //this one
<div class="b"></div>
<div class="c"></div> //this one
</div>
I tried the following rule:
.a > .b ~ .c {
background-color: red;
}
It works for case 1 - 3 but in the fourth example the first div with class c is not selected. AFAIK there is no other selector that would help me, so I'm trying my luck here.
PS: The div with class a can have more then 3 children. These are just examples and not actual use cases.