WordPress 随机背景
别忘了将你的背景图片命名为 1.jpg, 2.jpg, 3.jpg 等等.
别忘了将你的背景图片命名为 1.jpg, 2.jpg, 3.jpg 等等.
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" />
精彩图集
精彩文章






