Symphonious

Living in a state of accord.

The Semantic CSS Debate

Couple of very interesting articles today on architecture of CSS. Firstly Thierry Koblentz questions the benefits of separation of concerns – advocating a coding style where most style rules map a single classname to a single CSS property.

In complete contrast Ben Darlow argues the importance of semantic meaning, pushing back against techniques like OOCSS and BEM which move away from semantic class names in the name of modularity – generally resulting in long strings of class names on elements.

Both are definitely worth reading, but my experience points very strongly towards the benefits of truly semantic class names, especially when used with modern tools like SASS or LESS. It makes it far easier to track what styles are used where and makes the HTML much easier to read and maintain. I now find myself actively advocating against libraries like bootstrap due to the long term maintainability issues their approach to CSS causes.