CSS Override

download CSS Override 1.0.2

For the why and the what, make sure you check out my blog article Never hack your CSS files again, you’ll get a much better idea what this is for.

update: I added support for the iPhone in version 1.0.2. More info on why in my blog post about serving iPhone specific CSS.


  • A website hosted on a server that supports PHP
  • Basic knowledge of FTP, HTML, and CSS


  1. Download, unzip, and open in a text editor
  2. Modify line 22 ($css_dir = '/_css/';) to point to your CSS files on your server. The default points to a folder called _css located at the root of your website (where your index.php file is)
  3. Upload to your server
  4. Create CSS files for your target browser inside the CSS folder defined in step 2 (list of browsers available out of the box in this article)
  5. Add one line of code (see below) in your HTML header under your main CSS file
  6. That’s it… You’re done!

Code to add:

<?php require_once('/path/to/file/browser.php'); css_add(); ?>


The browser detection part of the script was written by Gary White. I only added the CSS functionality to it and I put it available for download here as a supplement to my blog article mentioned above, definitely not to show off my PHP skills ;)


If you have installation problems, check the path to the CSS folder in the PHP file, and the path to the PHP file in the HTML include. If you’re stuck, feel free to contact me and I’ll try to help.