Dynamic Cascading Style Sheets

Dynamic Cascading Style Sheets

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. Many content management systems have created additional modules, for example Drupal.[2]

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.

<!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 have 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";
?>

References

  1. ^ Koolstra, Jori (2 July 2002). "Dynamic CSS". http://www.jori-koolstra.nl/DCSS/dcss.txt. Retrieved 18 July 2010. 
  2. ^ ceardach (3 March 2010). "Dynamic CSS". Drupal. http://drupal.org/project/dcss. Retrieved 27 January 2011. 

External links


Wikimedia Foundation. 2010.

Игры ⚽ Поможем сделать НИР

Look at other dictionaries:

  • Cascading Style Sheets — CSS redirects here. For other uses, see CSS (disambiguation). For the use of CSS on Wikipedia, see Help:Cascading style sheets. Cascading Style Sheets Filename extension .css Internet media type text/css Developed by World Wide Web Consortium …   Wikipedia

  • Cascading Style Sheets — Vorlage:Infobox Dateiformat/Wartung/MagischeZahl fehltVorlage:Infobox Dateiformat/Wartung/Website fehlt Cascading Style Sheets (CSS) Vorlage:Infobox Dateiformat/Wartung/Screenshot Format …   Deutsch Wikipedia

  • Comparison of layout engines (Cascading Style Sheets) — Cascading Style Sheets CSS Animations Dynamic CSS Comparison of layout engines Comparison of stylesheet languages Internet Explorer box model bug CSS Zen Garden The Zen of CSS Design CSSTidy Style sheet Tableless web design Holy Grail (web… …   Wikipedia

  • JavaScript Style Sheets — (JSSS) was a stylesheet language technology proposed by Netscape Communications Corporation in 1996 to provide facilities for defining the presentation of webpages. It was an alternative to the Cascading Style Sheets (CSS) technology. Although… …   Wikipedia

  • Tableless web design — Cascading Style Sheets CSS Animations Dynamic CSS Comparison of layout engines Comparison of stylesheet languages Internet Explorer box model bug CSS Zen Garden The Zen of CSS Design CSSTidy Style sheet Tableless web design Holy Grail (web… …   Wikipedia

  • Comparison of stylesheet languages — Cascading Style Sheets CSS Animations Dynamic CSS Comparison of layout engines Comparison of stylesheet languages Internet Explorer box model bug CSS Zen Garden The Zen of CSS Design CSSTidy Style sheet Tableless web design Holy Grail (web… …   Wikipedia

  • HTML — For the use of HTML on Wikipedia, see Help:HTML in wikitext. HTML (HyperText Markup Language) Filename extension .html, .htm Internet media type text/html Type code TEXT …   Wikipedia

  • .htm — Vorlage:Infobox Dateiformat/Wartung/magic fehltVorlage:Infobox Dateiformat/Wartung/website fehlt HTML (Hypertext Markup Language) Dateiendung .html, .htm …   Deutsch Wikipedia

  • .html — Vorlage:Infobox Dateiformat/Wartung/magic fehltVorlage:Infobox Dateiformat/Wartung/website fehlt HTML (Hypertext Markup Language) Dateiendung .html, .htm …   Deutsch Wikipedia

  • HTML — Vorlage:Infobox Dateiformat/Wartung/magic fehltVorlage:Infobox Dateiformat/Wartung/website fehlt HTML (Hypertext Markup Language) Dateiendung .html, .htm …   Deutsch Wikipedia

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”