Remove unnecessary CSS, and cleanup existing CSS code.

An important part of your website is the CSS. To speed up websites, it is recommended that you keep your CSS as small as possible (no whitespace, all in one line) and remove all unused code. I'll be telling you about two, free services, that will handle both these tasks for you, so you don't have to do them manually

Unused-CSS

Unused-CSS logo

Unused-CSS, (as the name suggests) removed all of the CSS code that isn't used in your HTML code.

You just have to enter the URL, and then it scans the CSS. You have the option of checking the CSS of ALL your pages, which is the one I recommend.

For that, you have to enter your email ID, and it will mail you once done.

You then need to set up a password, to register (Won't even take a minute) and then you can check your CSS files.

It shows you a handy graph, which tells you how much it has been compressed.

It can make a few faults, but, they won't be much, and you can see by the code that it is a very simple fault.

Nonetheless, it is great for those users who are modifying an existing theme.

CleanCSS

You're done with removing that CSS which was not required, but, if you know, your existing CSS can be compressed further.

This is done by removing line spaces, comments, and putting all of the code in one line.

CleanCSS is very flexible, you get a number of ways to compress the code.

(Protip : You can also uncompress  the style, thus, making the code more readable. Again, useful when modifying an existing theme.)

You won't really need anything except highest and low (Some exceptions though) and by using it, you get a perfectly compressed code, ready to use.

(Protip#2 : Don't forget to backup your original files, it is tougher to edit in the compressed version!)

(Protip#3 : By default, comments of the code are deleted. You can stop that easily, by checking the box "Save comments" And then you can go on feel proud, how you saved the life of a few comments.)

Discuss on Twitter