Return to Snippet

Revision: 45145
at April 26, 2011 03:15 by ariunbolor


Initial Code
html,
body { height: 100%; }
 
img#bg {
position:fixed;
top:0;
left:0;
width:100%;
height:100%;
}

<body>


<?php $random_image = rand(1, 5); /*let's choose random image...*/ ?>
<img id="bg" alt="" src="<?php bloginfo('stylesheet_directory');?>/images/<?php echo $random_image; ?>.jpg" />

Initial URL


Initial Description
Do not forget to name images you want to use for background like 1.jpg, 2.jpg, 3.jpg etc.

Initial Title
WordPress Random Background

Initial Tags
css, php, wordpress

Initial Language
PHP