This site is designed for accessibility. Content is obtainable and functional to any browser or Internet device. This site's full visual experience is available in a graphical browser that supports web standards. Please consider upgrading your web browser.

Cascade, Specificity and Inheritance

It's not just proximity of the declaration of a style to its application that plays a role in the cascade. Although proximity is very important, specificity and inheritance also play important roles. Specificity is in many ways the underpinning of everything that is CSS. It seems simple-- a basic numeric mechanism for determining which selectors are more specific than others-- but upon a little digging, it soon becomes apparent that specificity is not only fraught with unexpected complications, it's also one of the least-understood aspects of CSS.

When styling rules or different styling sources are in conflict, CSS weighs the value of the applied rules to determine which has priority through an ordering process. Becoming aware of how cascade works will allow you to predict and control the interaction of styles on the final rendering.

<< previous | next >>