Thursday, July 1, 2010

Variables in a CSS style sheet

Here's something I learned about PHP yesterday that was just so much fun I have to share it with You.  Of course, You probably learned this on Your mother's knee:

I found out how to define and use variables in a CSS style sheet.  Very convenient when You want to, say, define a color once in Your CSS sheet and then use it multiple times throughout that CSS file.  I gather that normally CSS doesn't support variables, but there's a nice way around that limitation.  It basically involves using a style.php file rather than a style.css file, and then embedding variables in the CSS with php.  see: http://sperling.com/examples/pcss/

No comments:

Post a Comment

Constructive, concise comments are welcome.