У меня есть код:
<div class="parent">
<div class="second select">
<div class="third">
<button>OK</button>
</div>
</div>
</div>
и код SCSS к нему:
.parent{
.second{
.third{
button{
background: red;
}
}
}
}
Можно ли добавить класс выбора к кнопке в SCSS, не создавая для нее отдельный тип:
.parent{
.second{
.third{
button{
background: red;
}
}
&.select{
.third{
button{
background: green;
}
}
}
}
}
И, например, использовать миксин, чтобы найти этот предмет (возможно, есть готовое решение из коробки)
.parent{
.second{
.third{
button{
background: red;
@include find('.select',2){ // 2 or '.second' => 2 it's position (second) or search class ".second"
background: green;
}
}
}
}
}