My first rule in styling websites or applications is to style semantics over anything else.
Style the semantical markup. Semantics is about meaning, and by defining your content’s meaning in html and highlighting this meaning with your style brings you consistency from the start. This is not only nice to you as a maintainer of code, but also to your audience. It leads to consistent, predictable behaviors.
The counter movement is scoping it all in component attached css (thinking of web components or the trend to inlining css, either directly or using cryptic, automatically generated html classes and I’m even looking at excessive BEM), which forces designers to cross check all the applied styles deeply nested in a component. That’s not maintainable, its a mess made containable. Do not make exceptions the rule.
After having addressed the semantics, go ahead and continue with patterns like Object Oriented CSS or SMACSS. Another reference I’ve come to enjoy is The SASS way.
Update: This alistapart article resonates the same attitude towards styling.
Enjoyed this? Follow me on Mastodon or add the RSS, euh ATOM feed to your feed reader.
Dit artikel van murblog van Maarten Brouwers (murb) is in licentie gegeven volgens een Creative Commons Naamsvermelding 3.0 Nederland licentie .