Supriya Ghosh (Editor)

Dynamic Cascading Style Sheets

Updated on
Edit
Like
Comment
Share on FacebookTweet on TwitterShare on LinkedInShare on Reddit

Dynamic CSS, or DCSS, is an umbrella term for a collection of technologies used together to create dynamic style sheets, by using a combination of any server-sided programming language (such as PHP/ASP/Perl/JSP) and Cascading Style Sheets (CSS). The first idea of DCSS was written in July 2002 by Jori Koolstra, a Dutch programmer.

DCSS allows you to work with variables in CSS and dynamic rewriting of CSS source. Many content management systems have created additional modules, for example Drupal. Sass and Less can be used as dynamic stylesheet languages.

Example with PHP

Typically a web page using DCSS is set up in three files. A file that holds the CSS variables, a .php file that echos the CSS content and the web page where the CSS is needed.

A .dcss file normally looks like this.

The included .dcss.php file. Notice that a dcss file always has a .php extension.

And the file that holds the variables for the dcss.php file (often called vars.php).

References

Dynamic Cascading Style Sheets Wikipedia