How To: Clean and Optimize Your Blog’s Stylesheet (CSS)
September 26th, 2007
This is the third of a series of posts designed to discuss ways to monitor and improve your blog’s performance.
Now that you’ve got your website code validated, another good practice to be in is to keep your stylesheet (CSS) as clean and optimal as possible. I try to do this at least once a month, as I am regularly making changes to my site and my stylesheet tends to be filled with a bunch of styles that aren’t being used for anything. This can help improve the navigation of your stylesheet and keep your file size down, which will help lower the site’s load time on occasions when the web browser grabs your stylesheet.
The tool I use to keep my stylesheet clean is called Clean CSS. You can add your stylesheet’s URL, browse your computer’s harddrive for a copy of your stylesheet, or copy and paste your stylesheet on to their website and click Optimize CSS. Clean CSS will then dig through your code and clean it up for you. In order to clean it up, Clean CSS will remove code that isn’t doing anything, as well as make adjustments to how the code is written to shrink the file size of your stylesheet. An example would be them changing:
padding: 5px 8px 5px 8px to padding: 5px 8px
It will also shrink some of your hexadecimal color codes whenever possible.
Once it outputs your new stylesheet, Clean CSS will provide you your optimized code to paste it over your existing stylesheet. If you don’t like Clean CSS, you can also check out some other alternatives such as the CSS Optimizer.
Another thing I do to improve the navigation of my stylesheet is to break it down into categories. You can add titles that won’t count as code by using certain characters that look like this:
/*- Post Meta Section */
Any other tricks you do to keep a neat stylesheet? Sound off in the comments below!











Nice tip Kyle , this is one thing i need to work upon .
Yea, Indeed nice tip, let me try using the Clean CSS. I too have some junk in my CSS.
Of the 5 posts I did, I think this one was my favorite because it was so helpful to get my CSS cleaned up. Its sorted and makes it really clean and easy to find stuff I’m looking for.