| |

Tool Tuesday: Optimize your CSS with CleanCSS

CSS (Cascading Style Sheets), a very effective thing for a site / blog these days. They give you the chance to be completely consistent with the look and feel of your pages, while giving you much more control over the layout and design than straight HTML ever did.

The speed of your site also depends on your CSS, the complex the code, the slower is the site. Using repeated tagsTo make your site without loosing any CSS juice, you will need to optimize your CSS, make it simple and clean.

margin-top: 10px;
margin-right: 20px;
margin-bottom: 10px;
margin-left: 20px;

This is sometimes the default code style generated by softwares and even written by coders. But isn’t it too much heavy? How about trying this which is a optimized code instead of the above code:

margin: 10px 20px 10px 20px;

But on a part it is impossible to find all the silly errors in a CSS file of any theme. So for that there is a website / tool called CleanCSS.

CleanCSS optimizes the code, merge similar selectors, remove whitespace, remove useless properties etc. The interface of the website is also very easy, just paste your CSS in the box given, select the properties you want to clean, click the Process CSS button and bingo! It will find all errors and unnecessary things from your CSS and will remove it and will give you a error-free optimized CSS. You can even check that is your CSS valid or not ( I’m sure your CSS will be valid after being processed by CleanCSS 🙂 ).

Note : Hi, My name is Rishi and I am thankful to Ajay for giving me the opportunity to blog @ Techtites. I maintain a tech blog and call it Rishiraj. I hope that you will like my posts over here and the once already @ Rishiraj. 😀

3 Comments

  1. This reminds me to clean my CSS, I guess mine would be the most redundant one as I have taken the best from all CSS and I have implemented. I shall try CleanCSS. Nice Tip Rishiraj.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.