Reputation: 813
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?
Upvotes: 4
Views: 1934
Reputation: 1304
It would be faster for the browser to render CSS if you declared a general class for your fields and define styles for that particular class:
.field-img-gallery .field-img-gallery-0,
.field-img-gallery .field-img-gallery-1,
.field-img-gallery .field-img-gallery-2...
Upvotes: 0
Reputation: 10718
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-
Upvotes: 6