apply style to CSS classes with different numbers

css, css-selectors

Solution

The most concise way to do this is with a `substring` selector on the class attribute, although this won't work for some older browsers:

[class^="field-img-gallery-"] { /* CSS formatting code **/ }

The aboce snippet applies the css formatting to all elements that have a class that starts with `field-img-gallery-`

Problem

I don't know how to apply style to multiple classes with names .field-img-gallery-0, .field-img-gallery-1, .field-img-gallery-2... etc of course i can write it 50 times, but that's just stupid. can i somehow apply style to all this classes?

Original source