I made few lines project to explain my problem.
Is there a way in .scss file, how to make condition like: "(1)FIRST type/child that (2)DOESN'T CONTAIN some class"?
I tried pile of variants, like this:
// SCSS:
&:first-of-type:not(.banned) {
background-color: yellowgreen;
}
OR:
// CSS:
circle::first-of-type:not(.banned) {
background-color: yellowgreen;
}
But nothing worked for me.
Here is the whole code of my super-tiny project where I am simulating this problem:
body {
margin-top: 2rem;
text-align: center;
}
.circle {
width: 30px;
height: 30px;
background-color: blue;
border-radius: 100%;
display: inline-block;
&:first-of-type:not(.banned) {
background-color: yellowgreen;
}
}
.banned {
background-color: brown;
}
// .circle::first-of-type:not(.banned) {
// background-color: yellowgreen;
// }
<div class='circle banned'></div>
<div class='circle banned'></div>
<div class='circle banned'></div>
<div class='circle banned'></div>
<div class='circle banned'></div>
<div class='circle banned'></div>
<div class='circle banned'></div>
<div class='circle'></div> // <= this one I want to collor yellowgreen, but mainly in correct way I have described.
<div class='circle'></div>
<div class='circle'></div>
My codepen (Sass syntax works here): https://codepen.io/radekjakgit/pen/jOZgYGg