(a) Strip whitespaces like spaces, tabs, etc. (b) Remove all unused CSS classes & IDs (c) Use shorthand mode (use #CCC instead of #CCCCCC, replace 1.0em with 1em, etc)
Now all these are very minor changes but quickly add up and may make your CSS file lighter by a few kilobytes. This translates to faster web pages as smaller files take relatively less time to download.
And fortunately, there are plenty of CSS tools available online that can do all this for you - they will analyze your CSS files, remove unwanted stuff and thus reduce the overall size.
The tool offers various levels of compression depending upon how readable you want the code to be for humans.
You type the URL of your CSS file and a list of web pages that use that particular styles. CSS Checker will then quickly figure out all the unused styles that you may safely discard or move to another CSS file. Thanks Divya.
Unlike Clean CSS, the CSS Compressor tool can’t pull your CSS files - you need to copy-paste the CSS code in the text area.
0 comments:
Post a Comment