CSS Inheritance, The Cascade And Global Scope: Your New Old Worst Best Friends
Another wonderfully penned article from Heydon Pickering on the inheritance of CSS. The article is around using the inheritance and the C in CSS (cascading) to keep your CSS more consistent and lighter. Personally, I have not worked on large scale projects with 10’s or 100’s of developers touching the CSS so the benefits of adding classes on everything and doing the BEM approach are wasted on me and my projects. I think that’s why this article resonates so well with me, it’s getting back to the way I tend to approach builds and we all love it when someone justifies your approach.
There’s a wonderful discussion (if not pointy on occasion) in the comments, but I’m interested to hear about your experiences. Do you use BEM, SMACSS, OOCSS or something similar for your projects? How do the pro’s and con’s weigh up?
Despite these features enabling a DRY, efficient way to style web documents and despite them being the very reason CSS exists, they have fallen remarkably out of favor. From CSS methodologies such as BEM and Atomic CSS through to programmatically encapsulated CSS modules, many are doing their best to sidestep or otherwise suppress these features. This gives developers more control over their CSS, but only an autocratic sort of control based on frequent intervention.
An excerpt from CSS Inheritance, The Cascade And Global Scope: Your New Old Worst Best Friends