A small problem with the use of css style

Syntax scss

.a {
  background-color :red;
  &.b{
    background-color: green;
  }
  &-c{
    background-color: blue;
  }
  .d{
    background-color: yellow;
  }
}

//ab c d 
//b
//

<div class="a b">
</div>

<div class="a">
 <div class="b">
 </div>
</div>

<div class="b">
</div>
Apr.11,2021

<div class="a b">
</div>

& means to refer to the parent selector. If there is one, it means that the reference is not in the same element

.
.a {
  .d{
    background-color: yellow;
  }
}

indicates that an and d are applied to father-son or grandfather-descendant nodes



    </div>
</div>
Menu