Dynamic Style Sheets with Server Side Scripting

May 5, 2010

We are currently working on redesigning our top level pages at UNC. We are using multiple style sheets to separate out the structure of the page from the colors and typography. All pages will have the same layout but will have different patterns and colors.

I want to use one style sheet (rather than multiple) so the user can’t remove the parts they don’t think are necessary. I also want this one style sheet to be able to access different CSS files depending on the querystring.

ASP:

<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>

<%response.ContentType="text/CSS"%>

@import url("../uncheader.css");

@import url("structure.css");

@import url("typography.css");

@import url("print.css") print;

<% if (request.QueryString("c") = "blue") then %>

@import url("colors/color-blue.css");

<% else if (request.QueryString("c") = "red") then %>

@import url("colors/color-red.css");

<% end if %>

Tags: ,

Comments are closed.