Reputation: 125
You know in Java/PHP you can do something like this:
if (c.bigX == 1 || c.smallX == 2 || c.mediumX == 6) {
something here
}
How can I make it with CSS?
I have 5 classes, and I want them to do the same thing. instead of making a lot of lines. Thanks
Upvotes: 1
Views: 164
Reputation: 86
.class1, .class2, .class3, .class4, .class5 {
property:value;
}
This will help
Upvotes: 0
Reputation: 46675
Use commas in your selector:
.class1, .class2, .class3 {}
Bear in mind that each clause in such a list is a complete selector in its own right; that is
div .class1, .class2 {}
matches class1
descendants of div
s; and all .class2
elements. If you wanted class1
or class2
descendants of div
s, you need:
div .class1, div .class2 {}
Upvotes: 0