How could apply CSS property on class and element specific at same time with SCSS?

Viewed 28

As shown underneath, there are two (div & span) HTML element having same class (content ), but on span only, I want add color property. How it will be done in SCSS?

.content {
  padding-left: 30px;
  span#{&} {
    color: red;
  }
}
<div class="content">Lorem ipsum dolor sit amet</div>
<span class="content">Lorem ipsum dolor sit amet</span>

Please help.

2 Answers

You can use speudo class :is,

.content {
  padding-left: 30px;
  &:is(span) {
    color: red;
  }
}
Related