This is my goal:
.item.bold,
.item.blod .child-1,
.item.blod .child-2 {
// certain properties here
// which apply both to parent and children
// but only if parent has class "bold"
}
Is there a simple way to do that in scss?
I know this:
%my-properties {
// some properties
}
.item {
&.bold {
@extend %my-properties;
.child-1,
.child-2 {
@extend %my-properties;
}
}
}
But is there a way to match both parent and children at once?
question from:
https://stackoverflow.com/questions/65843749/scss-select-parent-and-children-if-parent-has-certain-class 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…