1

I have got two classes coming under list "active" and "main-tab-list like and want to give a css for this combined classes.

2
  • @Vipin, Can you please explain a bit more about what isn't working? Commented Oct 9, 2013 at 6:12
  • 1
    its about tab making from bootstrap.
    – Vipin Raj
    Commented Oct 9, 2013 at 6:15

3 Answers 3

2

Just cascade them

 .main-tab-list.active{color:red;}

This ensures that only .main-tab-list which are active will be selected. Other classes who also have .active class on it won't be affected. It simply says, apply this rule to all .main-tab-list classes which at the same time have .active class

1

If you want special styles to be applied to elements that have both classes then use a rule such as:

.active.main-tab-list {/*note there's no space between .active and .main-tab-list*/}

If you want the styles to apply to elements that have either of the classes group them:

.active ,
.main-tab-list {/*newline is not required*/}

See also Select element based on multiple classes and http://www.w3.org/TR/CSS2/selector.html

0

you can combine it with comma. for example,

.active,.main-tab-list{color:red;}

Not the answer you're looking for? Browse other questions tagged or ask your own question.