The Cascade Is a Feature
Most specificity wars start with forgetting that the cascade is on your side.
Let it work
We tried this on a client site first, because a real deadline is the only honest test. It held up better than we expected, and the handover notes were half as long as usual.
- Set type once on the body
- Colour links in one place
- Scope overrides with a single class
The trick is to decide once and write it down. Most messy stylesheets are not badly written; they are a record of the same decision being made twenty different ways.
Inheritance is free styling. Use it before you write a new rule.
Nothing here needs a framework. A few lines of plain CSS and a template that prints clean markup will get you most of the way.
We checked every page at 390 pixels wide before calling it done. Phones are where layouts break first, and where most of our readers are.
It is tempting to add one more variation. Resist it. Every option you add is one more thing to test, document and eventually delete.
3 thoughts on “The Cascade Is a Feature”
This is exactly the kind of post that keeps me reading this blog.
Shared this with my students today.
Yes! Especially on phones.