[thelist] Variable Stylesheets?

lon.kraemer lwkraemer at earthlink.net
Sat Dec 1 21:46:29 CST 2001


I asked myself "Wouldn't it be great if CSS enabled the use of variables to
define attributes?" I.E. Imagine setting a variable for a color at the top
of a stylesheet and use it to set all attributes using that color in the
stylesheet. Another one for my wish list?

Well, I certainly can do that with ASP. Hmmm... What if I coded my
stylesheet appropriately and saved it as an ASP file. Then name that file in
my call to the stylesheet, thus:
<link rel="stylesheet" type="text/css" href="varcss.asp" title="style">

YA Baby! Programmable stylesheets!

But wait! It's an ASP file, so I can tack on a querystring:
<link rel="stylesheet" type="text/css" href="varcss.asp?bc=000"
title="style">

ALRIGHTY then! I can easily restyle "on-the-fly" without touching the
stylesheet itself!

There's more! Why not make that querystring variable in the calling ASP
page?:
<link rel="stylesheet" type="text/css" href="varcss.asp?bc=<%= bc %>"
title="style">

OH YA! One stylesheet... infinite styles... user selectable! Colors, font
sizes, flexible layouts, etc.

I've never read anything resembling this technique. Have I stumbled upon a
really useful new "tool" or is it just folly?

Here's a quicky sample: http://www.famnets.com/varcsstest.asp

LK






More information about the thelist mailing list