Your answer is Specificity
Specificity is a mechanism within the CSS cascade that aids conflict resolution
Basically it determines preference of CSS styles, over and above the cascading nature of stylesheets
Order of Precedence of Specificity:
| Type | Specificity |
|---|---|
| Inline Style | Highest |
| Highest Number of #id selectors | Wins |
| Highest number of class, attribute and pseudo selectors | Wins |
| Highest Number of element selectors | Wins |