Specificity

Specificity is measurement of the weight associated with a CSS rule. This is one of the features that makes cascading stylesheets so powerful. If you find yourself attaching classes and not seeing the styles applied, then it is probably a specificity issue. In short, styles applied to id attributes weigh more than those applied to class attributes, which weigh more than those applied to tags. Specificity becomes complicated when considering CSS rules with multiple id, class, or tag declarations. No matter how many tag declarations in a rule, they will never outweigh a class declaration, and the same is true that many class declarations can never outweigh an id.

Anyway, this is described in full by an article on Smashing Magazine:

CSS Specificity: Things You Should Know