Scratchpad

Dynamic CSS Using PHP

(, — )

12 Jul. 2007

I've been thinking for ages (well, the last 3 years anyway) that it would be cool to try to use PHP in a CSS document to do a variety of things, namely:

  • Display certain things based on browser detection
  • Randomly change certain elements (eg - a background image or a font size) each time the stylesheet is reloaded

But, of course, I always just thought about it and never actually tried it, because (stupidly) I figured it would not actually work. What was I thinking?! Now someone else went off and did it and they get all the credit. Sigh.

On the bright side, I will maintain that the random item changing (as opposed to browser detection) was totally my idea and still is. Now if I can just find a reason to implement it somewhere......