In Sass, we all use to do things like this:
button {
@extend %button;
&.previous,
&.next {
background: blue;
}
}
Today, I need the exact opposite: check the element type inside a class selector. Here's my first attempt, which I expected to work:
.previous,
.next {
@extend %button;
&span {
opacity: .3;
}
}
Unfortunately, this outputs selectors like .previousspan
and .nextspan
. I tried to use span&
, or interpolation as I highly suppose it could solve my problem, but I'm stuck.
Any idea?
Note: I could obviously put this
span
selector outside (and that's what I've done to get it to work), but this is not the point of my question. I'm really searching for the right way to do it, thanks.