0

I need to add a specific style for the parent element, but only if this element has a child with the exact name. For example:

<div class="parent-element">
   ----! <div class="child-element-1></div> !----
   ----! or !----
   ----! <div class="child-element-2></div> !----
</div>

Parent element can have one of this child elements. I searching for something like this:

.parent-element {
 parent: &;
 .child-element-1 {
   parent { 
    overflow: scroll;
  }
 }
}

it means, if parent has a child 1, style it like this, if child two: style it another way.

Adam Jakś
  • 53
  • 1
  • 7

1 Answers1

0

Parent selectors by the child are not allowed in CSS. Your best bet is playing around with SASS functions.