龙盟编程博客 | 无障碍搜索 | 云盘搜索神器
快速搜索
主页 > web编程 > php编程 >

WordPress 随机背景

时间:2014-07-22 14:52来源: 作者: 点击:
分享到:
别忘了将你的背景图片命名为 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" />
精彩图集

赞助商链接