CSS question...

I'm going to re-do my website. I plan on using CSS for the bulk of all the decorative stuff. I would like to have multiple templates on my site, using different CSS sheets, and have a random one come up each time someone goes to my site. Is this even possible, & if it is, how hard is it?

Not sure if that made sense to anyone or not

Vex 16 years ago
oh its very easy really

You have 2

(simple and easy and i can help you with these two)


* use PHP
* use Javascript

Are you wanting it to be a persistent stylesheet when they visit from page to page, or change for every page the viewer goes to ?
Verity 16 years ago
Hmm, you know, I haven't even thought about if I want it to be persistent, or change. Haven't got that far yet. This is still in the early planning stages . I'll have to think on that, & get back to you when I'm a bit further along.

I was just wondering how simple/hard it would be, before I got a bunch of css sheets designed & then realized that it was way over my head.
Vex 16 years ago
pretty easy.

take all your CSS files, and put them in the same directory, name them chronologically ( ie: css1.css, css2.css, css3.css )

if you want to use php :

nonpersistent between pages :

$num = rand(1,3) // 1 being the beginning #, 3 being the last # of your CSS sheets
echo "";

( no * .. fucking crap ass vbulletin parsing ! )

that will pick a random number between 1 and 3, including 1 and 3, and load that specific CSS sheet : ( for instance, it rolls 2 = loads ccs2.css )

Javascript would be similar, but I am more fluent in PHP than Javascript so that'd take a moment to write and test

For persistency between pages you'd have to implement sessions or cookies, cookies being the easiest