给博客添加一个背景图

实时刷新背景图

美好的事情总是在不经意间发现

错过了

就可能不会再回来了

言归正传:这个实时刷新效果萌看还挺新颖

其实就是根据api接口刷新的时候获取一个图片而已

页面定制css代码:

body {
    font-size: 15px;
    padding: 0;
    margin: 0;
    font-family: "微软雅黑","宋体",Arial;
     100%;
    height: 100%;
    background: #205424 url(http://api.3ewl.cc/acg/img.php) no-repeat top 
    center fixed;
    background-size: cover;
  }

然后保存一下

然后可以去看看自己的博客园了

然后就没有然后了....

ps:注意设置一下透明度,这样效果会更好一点

可能有些下伙伴不喜欢这个类型的背景,(其实我也不喜欢这个只是没找到合适的接口)那没关系,那咱们就换个api接口

当然了你可以自己动手搜一下自己喜欢的api

枚举一些随机图片的接口

http://lorempixel.com/1600/900

https://unsplash.it/1600/900?random(国内加载略慢)

https://uploadbeta.com/api/pictures/random/key=BingEverydayWallpaperPicture【返回必应图片】

环境背景:

https://img.xjh.me/random_img.php?type=bg&ctype=nature&return=302

http://img.xjh.me/random_img.php?type=bg&ctype=nature&return=302

注: http(更快,快一点点,不安全,可能会被劫持):

人物背景:

https://img.xjh.me/random_img.php?type=bg&ctype=acg&return=302

http://img.xjh.me/random_img.php?type=bg&ctype=acg&return=302

注:http(更快,快一点点,不安全,可能会被劫持):

https://api.24bp.cn/API/PC.php

https://api.ixiaowai.cn/api/api.php

https://api.lyiqk.cn/purelady?1559f782


注:
岁月小筑

这个实时背景图刷新到此结束了,不知道看到的小伙伴有木有搞定...

原文地址:https://www.cnblogs.com/gaoht/p/9431623.html