How to select two or more elements with the same class in LESS?

Is there a short form in LESS to select two or more different elements with the same classes?

For example instead of writing input.ng-invalid.ng-dirty, textarea.ng-invalid.ng-dirty, button.ng-invalid.ng-dirty how could I write this shorter?


solution

You could use the following:

input, textarea, button {
  &.ng-invalid.ng-dirty {

  }
}

Where & represents the current selector parent. In other words, you are not selecting descendants, but rather elements with the classes .ng-invalid.ng-dirty. (i.e., input.ng-invalid.ng-dirty..)