You can edit almost every page by Creating an account. Otherwise, see the FAQ.

Dynamic cascading style sheets

From EverybodyWiki Bios & Wiki



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.[1]

DCSS allows you to work with variables in CSS and dynamic rewriting of CSS source. There is a module for Drupal which implements DCSS.[2]

Example with PHP[edit]

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.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <title>DCSS example</title>

    <style type="text/css">
      <?php
         /* Include the style sheet */
         require_once("sheet.dcss.php");
      ?>
    </style>

  </head>
  <body>
  </body>
</html>

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

<?php

/* Include the variables file */
require_once("vars.php");

echo "p";
echo "{";
echo "font-family:    \"$FONT_TYPE\";";
echo "}";

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

<?php

$FONT_TYPE = "Courier New";

See also[edit]

References[edit]

  1. Koolstra, Jori (2 July 2002). "Dynamic CSS". Archived from the original on 19 August 2010. Retrieved 18 July 2010. Unknown parameter |url-status= ignored (help)
  2. ceardach (3 March 2010). "Dynamic CSS". Drupal. Retrieved 27 January 2011.

External links[edit]


This article "Dynamic cascading style sheets" is from Wikipedia. The list of its authors can be seen in its historical and/or the page Edithistory:Dynamic cascading style sheets. Articles copied from Draft Namespace on Wikipedia could be seen on the Draft Namespace of Wikipedia and not main one.