The Cascade Algorithm

An element in a web page can be selected by more than one rule, and thus have competing rules.  The CSS cascade algorithm defines which rules have precedence. The algorithm ranks the rules according to importance, specificity, and source code order.  Please now read the MDN tutorial titled Cascade and inheritance to understand the cascade algorithm used by browsers.