Gzipping your CSS


/ Published in: PHP
Save to your folder(s)

CSS files for larger sites can become pretty large themselves. Gzipping or compressing these files has shown to provide a reduction in the neighborhood of 70-80% of the original file size, a fairly significant 'weight loss'.


Copy this code and paste it in your HTML
  1. <?php
  2. ob_start ("ob_gzhandler");
  3. header("Content-type: text/css; charset: UTF-8");
  4. header("Cache-Control: must-revalidate");
  5. $offset = 60 * 60 ;
  6. $ExpStr = "Expires: " .
  7. gmdate("D, d M Y H:i:s",
  8. time() + $offset) . " GMT";
  9. header($ExpStr);
  10. ?>

URL: http://www.fiftyfoureleven.com/weblog/web-development/css/the-definitive-css-gzip-method

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.