Dynamically Generating CSS

Aug 25

Dynamically Generating CSS

CSS Colors: Take Control Using PHP: Good article on how to use PHP (or any scripting language, really) to generate your CSS.

While many web sites use powerful programming environments to create HTML, these same tools are usually ignored when it comes to creating Cascading Style Sheets (CSS). This article describes how to take control of your colors in CSS using PHP.

Since CSS doesn’t support variables, it gets to be a pain to change colors after a while, since you have to change the same color in so many places. This is a good solution, just make sure you use the “header” function to declare a MIME type, or you’ll anger the validation Gods.


Comments

by Philipp Lenssen,   August 26, 2004 5:17 AM  

It may make sense to use XML to store the CSS data then. I did something in ASP/XML some years ago and called it CSSML: http://outer-court.com/tech/file/cssml.zip


by Mark,   August 26, 2004 7:47 AM  

"these same tools are usually ignored when it comes to creating Cascading Style Sheets (CSS). "

I fall into that category but now that I can convert a .css file to php oooooh the possibilities.

Great find! Thanks!



Add Comment