Reputation: 57
<div class='splash yellow'>
<span>Yellow</span>
</div>
<div class='splash green'>
<span>Green</span>
</div>
<div class='splash red'>
<span>Red</span>
</div>
.splash {
margin: 15px;
+ .red {
background-color: red;
}
+ .green {
background-color: green;
}
+ .yellow {
background-color: yellow;
}
}
https://jsfiddle.net/8e27qyc9/2/
How come the yellow background isn't applied like red and green in the fiddle example? What could be causing this behavior?
Upvotes: 0
Views: 36
Reputation: 57
I confused sibling selector with compound selector.
Solution:
.splash {
margin: 15px;
.red& {
background-color: red;
}
.green& {
background-color: green;
}
.yellow& {
background-color: yellow;
}
}
Upvotes: 0