Let's say I have the following bit:
<div class="class1 class2">...</div>
<div class="class1 ...">...</div>
Is there a way to make an SCSS rule that goes something like "for elements with class class1
and any other classes but class2
apply these properties". So if by default the divs would have a blue background, I would be able to write something like this and make all divs that are class1
, but not class2
, have a red background.
.class1 && !.class2 { // invented syntax, of course
background-color: red;
}
I know there are other ways of achieving this, but I'm curious to know if you can somehow do it this way.