How Cascading Works

As pointed out previously, the word cascading (p. 15) signifies that a CSS-styled document can derive style information from varying sources, rather than simply from a single style sheet. What is termed as the cascade is the mechanism by which styles from multiple sources can interact within the same document, with styles of higher weights falling (or cascading) through to be expressed in the document, while styles of lesser weights are caught up in the cascade and suppressed. If you think of the cascade as water flowing over a waterfall, cascading off of ledges and outcroppings, with gravity (or weight) entirely governing its course, that should give you a good visual hint of what the cascade is and how it works.

Modularity ...

Get Cascading Style Sheets (CSS) by Example now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.