It is possible to compress your CSS style sheet with PHP. Here is how you can do that.
Create a CSS file with .php extension. For example; stylesheet.php
1 2 3 4 5 6 7 8 9 10 |
<?php 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"; header($ExpStr); ?> |
Now in the same file, start writing your CSS styles and classes. For example,
1 2 3 4 5 6 7 8 9 10 11 |
#wrapper { width: 980px; background-color: #FFF; } .MyHeadings { font-family: Georgia, "Times New Roman", Times, serif; font-size: 18px; color: #666; text-decoration: underline; } |
You can then call your css in your web pages by simply using the LINK tag.
1 |
<link rel='stylesheet' type='text/css' href='stylesheet.php' /> |
Hope it will be useful for someone.