The cascade
Typically, the cascade part of Cascading Style Sheets is useful. Even if specificity is very equal across the selectors used, the cascade allows equivalent rules further down the CSS to be applied over existing rules higher up.
However, in a large codebase, the cascade presents an undesirable temptation; the ability for developers to take a short cut of amending the existing CSS by simply writing more new code at the bottom of the existing CSS.
This temptation is both real and easy to identify with. It can be tempting for a number of reasons. As an example, authors more familiar with other languages that need to make changes to the CSS may lack the confidence or intimate knowledge of the CSS codebase to be able to confidently remove ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access