Topic: Loading a Random BG using CSS (Page 1 of 1) Pages that link to <a href="https://ozoneasylum.com/backlink?for=28884" title="Pages that link to Topic: Loading a Random BG using CSS (Page 1 of 1)" rel="nofollow" >Topic: Loading a Random BG using CSS <span class="small">(Page 1 of 1)</span>\

 
Radical Rob
Bipolar (III) Inmate

From: Lost Angeles Kalifornia, via Hawaii....
Insane since: Jun 2001

posted posted 02-04-2007 18:24

Is there a way to do this? I want to have about 10 images and I'd like the BG to be random. I know I can do it if it was a regular img, .... i dunno, practical?

DL-44
Lunatic (VI) Inmate

From: under the bed
Insane since: Feb 2000

posted posted 02-04-2007 18:33

Through CSS alone, no.

I would do this by setting several classes in your stylesheet which define different background images, and use whatever method you prefer to randomly declare the class for that element in your markup.

poi
Paranoid (IV) Inmate

From: Norway
Insane since: Jun 2002

posted posted 02-04-2007 19:36

For the cross fading banner(s) on my site, I wrote a PHP script that returns a random image in its folder. I can use it directly as the src attribute of an IMG tag or as the background-image property of a CSS rule.

To make the whole thing look a bit cleaner from the outside, I named the PHP script random.jpg and use an .htaccess to make sure it's processed as PHP.

mas
Maniac (V) Mad Librarian

From: the space between us
Insane since: Sep 2002

posted posted 02-04-2007 23:49

i did pretty much what poi mentioned here by using the sig rotator script. i asked for permission of course

The Space Between Us | My Blog: lukas.grumet.at



Post Reply
 
Your User Name:
Your Password:
Login Options:
 
Your Text:
Loading...
Options:


« BackwardsOnwards »

Show Forum Drop Down Menu