简介
本次以随机图片API中的环境背景图片为例子,调用地址为:
https(推荐): https://img.xjh.me/random_img.php?type=bg&ctype=nature&return=302 http(更快,快一点点,不安全,可能会被劫持): http://img.xjh.me/random_img.php?type=bg&ctype=nature&return=302
如果需要人物背景图片,请把ctype的值由nature修改为acg,或留空,如:
https(推荐): https://img.xjh.me/random_img.php?type=bg&ctype=acg&return=302 http(更快,快一点点,不安全,可能会被劫持): http://img.xjh.me/random_img.php?type=bg&ctype=acg&return=302
使用方法
用法一:直接写入网页
直接在标签中添加
style="background-repeat:no-repeat; background-attachment:fixed;background-size:cover;background-image: url(https://img.xjh.me/random_img.php?type=bg&ctype=nature&return=302);"
此方法略微提升加载速度?(怀疑)
用法二:写入CSS样式文件
当要插入的标签含特定id时,使用: #id{background-repeat:no-repeat; background-attachment:fixed;background-size:cover;background-image: url(https://img.xjh.me/random_img.php?type=bg&ctype=nature&return=302);} 当要插入的标签含特定class时,使用 .class{background-repeat:no-repeat; background-attachment:fixed;background-size:cover;background-image: url(https://img.xjh.me/random_img.php?type=bg&ctype=nature&return=302);}
效果图:
请参考本站背景,如果没看到,请刷新浏览器缓存,Ctrl+F5,或使用开发者工具,屏蔽缓存。如果还没看到,那就请看下图:
朋友 交换链接吗
小哥能不能指导下,小站的导航栏透明,以及下拉时候保持固定,怎么修改的..
#kratos-header-section {
padding: 0;
position: fixed;
top: 0px;
left: 0;
width: 100%;
z-index: 2;
background-color: rgba(0,0,0,0.3);
不同主题有不同修改方法,用Kratos的话,就把这一段添加到style.css最后
请问大佬,怎么在Kratos主题中调用此api
#kratos-page:after {
z-index: -1;
content: "";
display: block;
top: 0;
left: 0;
width: 100%;
height: 100%;
opacity: .8;
background-repeat: no-repeat;
background-attachment: fixed;
background-size: cover;
position: absolute;
-webkit-transition: .5s;
-o-transition: .5s;
transition: .5s
background-image: url(https://img.xjh.me/random_img.php?type=bg&ctype=nature&return=302);
}
在style.css后面加上这一段就行了
已经按大佬说的添加,可是并没有任何效果啊....贼喜欢大佬网站样式,求帮忙解决啊,付费也行啊啊啊啊啊啊
把图中那个background删掉就可以了,具体在哪的我也不太记得了
你可以试试再加一行
#kratos-blog-post{background:;}
挖坟
这是精品置顶高亮帖,不是坟贴
哦哦那重新给你埋起来
你们快放开我,我要把他拉出去十循