A. L
A. L

Reputation: 12639

scss - starting a partially named class

I was wondering if it was possible to have a partially completed class name, which then I could fill in some how e.g.

.theme-color-* {
  happy {
    color: yellow
  }
  angry {
    color: red
  }
  sad {
    color: blue
  }
}

of course, this represents .theme-color-happy, .theme-color-angry, .theme-color-sad

Upvotes: 2

Views: 74

Answers (1)

Sergio Tx
Sergio Tx

Reputation: 3856

Yes, you can do that, but you have to use &:

.theme-color- {
  &happy {
    color: yellow
  }
  &angry {
    color: red
  }
  &sad {
    color: blue
  }
}

Upvotes: 5

Related Questions