Tags: style

Proposal - CSS Namespaces

CSS has no proper namespaces

The other day I was thinking about CSS and the practices that come with it. It’s a good idea to have a lot of shared elements on your website; this means you can use a common CSS file for all pages and more specific stylesheets that load on top of that if necessary. However, as these specific styles may have overlap, you have to either keep these in separate files (and not concatenate them: an extra request) or have different classes on different pages to differentiate them from each other. That’s quite tedious, considering the specificity might be a large chunk of CSS, prepending every selector with the class selector for that page is few extra precious bytes and keystrokes.


Posted 2012-06-19T05:00:00.000Z.



If you stumbled on this, you’ve probably read where this all started from. An issue was reported for Twitter Bootstrap, because JSMin failed at minifying the code in bootstrap, due to a combination of two simple lines. @fat responded that the code is correct and that the problem is with JSMin, and closed the issue. While I disagree a bit with that decision, since it’s breaking things, I acknowledge that he’s correct in saying so, and it’s his decision.


Posted 2012-04-17T05:00:00.000Z.