1. [PHP]代码
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" />