This question has already been answered:

Please specify, it is possible to assign properties to an external class by the condition of presence inside a certain class. Example: You need to assign properties to the class = "g-grid" if there is a class Test1 inside

<div class="g-container"> <div class="g-grid"> <div class="Test1"> </div> </div> <div class="g-grid"> <div class="Test2"> </div> </div> </div> 

Reported as a duplicate at Qwertiy Jan 22 '18 at 9:12 .

A similar question was asked earlier and an answer has already been received. If the answers provided are not exhaustive, please ask a new question .

    2 answers 2

    Selectors for the parent regarding the child in the css do not exist. Possible options:

    1 - If you want to check only for the presence of children, then in css you can use the pseudo-class :empty .

    2 - Add classes to the parent.

    3 - Find using js.

      the solution turned out to be easier selector:nth-child(an+b){ properties }