Dynamically Generating CSS

By Deane Barker on August 25, 2004

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.

Gadgetopia

Comments

  1. “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!

Comments are closed. If you have something you really want to say, email editors@gadgetopia.com and we‘ll get it added for you.