Object Oriented CSS
I think I’ve said the words “goddamn, I love CSS” at least 12 times in the last month or so, mainly because it’s so easy to use powerfully and cleanly. I have a thing for organizing code, it just feels good when things are.
I’ve been challenging myself to write better CSS and using it in a way that promotes scalability and code readability. There are so many ways to use your noggin’ and use classes and IDs to build your site properly. I just read an article on object oriented CSS that takes this kind of thinking to the next level.
Using multiple classes on markup objects, heavily reducing the use of IDs to style elements, and attempting to throw nth-of-type and “location” based styles- you can split a lot of commonly assigned styles to one class and reuse it in conjunction with, say, how you’d style the div that contains it.
It’s kind of obvious, and it’s something that I’ve been working towards on my own, but this article is great at outlining it as a concept.
Smashing Magazine - An Introduction to Object Oriented CSS (OOCSS)