CSS Reusability

Chris Coyier posted a great question over at CSS-Tricks.

You've probably coded up something like that, right? How many times? A lot? Did you do it from scratch each time?

I'll be honest, aside from the usual normalise.css I don't re-use much CSS. Unlike PHP or JS, where I re-use a lot of code.

Chris continues on in the comment thread,

If a developer needs a login function for a website, do they write it from scratch? I bet very rarely. They use an existing project (e.g. a CMS like WordPress) or a modular component to a framework (e.g. a Rails gem). What makes back-end so code much more reusable?

Chris has a great point. I know the obvious answer is that CSS deals with layout and design, which is wildly different from project to project. Yet, I think he's on to something, I need to be more efficient with the code I write. I can be more efficient by starting to think about CSS in a more modular way, what little re-usable objects or chunks can I carry from project to project?

Have a comment? Send an email to my public inbox. Please follow proper mail etiquette.