How to compress my CSS with gZIP?

To compress your CSS files with gZIP there are two things that you should do.

First, add the following line to the .htaccess file in your public_html folder:

AddHandler application/x-httpd-php52 .css

By doing this, you allow the server to process .css files through PHP.

Next, add the following lines at the very beginning of your .css file(s):

ob_start (“ob_gzhandler”);
header(“Content-type: text/css; charset: UTF-8″);
header(“Cache-Control: must-revalidate”);
$offset = 60 * 60 ;
$ExpStr = “Expires: ” .
gmdate(“D, d M Y H:i:s”,
time() + $offset) . ” GMT”;

By doing this, you will enable the gZIP compression for your CSS file. For bigger websites there will be a significant improvement in the loading speed of your pages.