[thelist] Variable Stylesheets?

lon.kraemer lwkraemer at earthlink.net
Sun Dec 2 15:57:51 CST 2001


> > Here's a quicky sample: http://www.famnets.com/varcsstest.asp
>
> hi lon
>
> very nice technique

Thanks rudy

> i've seen several ways of letting users choose styles (including one that
> uses alternate style sheets, i.e. does not involve a trip back to the
> server), but your method does seem to offer a great deal of flexibility

It does basically use 'alternate' stylesheets, though, in this case they are
dynamically written. Additionally, depending how many times a user changes
her mind about chosen preferences, each is cached at the browser like any
other stylesheet, so no further 'trip(s) back to the server' are necessary.
:)

> i would've thought that perhaps some older browsers might require the
> linked style sheet to have the ".css" extension, but it does work in
> windows netscape 4.04 and 4.75 (the only older css-capable browsers i've
> got), so it would appear you've got something there

Indeed, that's when 'the light came on' ... allowing a linked stylesheet to
have .asp extension w/querystring!

> in fact, it even works if you code any valid colour code into the url
> e.g. my favourite, screaming yellow F9F307

Sure, any acceptable color code could work. I used the abbreviated #xxx,
passing just the xxx and prepending the # later. #xxxxxx works too, but a
slight mod would be needed for RGB.

> neat!
>
> f.y.i. the solid lines that make up your tabbed effect don't work in
> netscape 4.x

Yup, I should have added that cavaet. I would combine this with the "ohno"
class ala WaSP! I did also test it with:
<style media="all" type="text/css">@import "varcss.asp?bc=<%= bc
%>";</style>
which also works as advertised. I've tested only in IE5 (ok), NN4 (so-so),
NN6 (ok), Op6 (ok).

> rudy

LK







More information about the thelist mailing list