Trim your CSS

If you’re not careful when developing a website, you may end up with a bloated CSS file that is easy to get lost in and difficult to maintain. It will also add to total page weight, taking away some of the advantage of having nice and clean HTML. From personal experience I can tell you that a CSS file for a large and complex website can end up containing quite a bit of redundant code.

If you get rid of that code and clean up your CSS file, it will be easier to come back to and make changes, and you will save some bandwidth. John Gallant (a.k.a. Big John) and Holly Bergevin tell you how in Writing Efficient CSS at Community MX. Methods include shorthand properties, multiple declarations, default values, inheritance and white space.

Posted on December 3, 2003 in CSS


  1. Yeah, I just ended up there myself, and that was only a small site such as my personal homepage. I ended up with lots of overlapping classes and other cruft in my CSS. So I decided to redesign it from scratch and keep a nice, clean CSS file this time.

Comments are disabled for this post (read why), but if you have spotted an error or have additional info that you think should be in this post, feel free to contact me.