直接动工
我们在 hexo根目录 \source\css 或者 主题 \themes\butterfly\source\css 目录内 创建一个css文件 例如: css.css
复制下面css代码进去文件 ,修改文件中的图片改为自己的图片 例如: url(../img/beijing.jpeg); 改为 url(您的图片网址);
/*背景*/
#web_bg {
background: url(../img/beijing.jpeg); #浅色模式背景图
}
@media screen and (max-width:860px) {
#web_bg {
background: url(../img/shouji.jpeg); #浅色模式手机背景图
}
}
[data-theme='dark'] #web_bg {
background: url(../img/ybeijing.jpeg); #深色模式背景图
}
@media screen and (max-width:860px) {
[data-theme='dark'] #web_bg {
background: url(../img/yshouji.jpeg); #深色模式手机背景图
}
}
[data-theme='dark'] #web_bg,#web_bg{
background-attachment: local;
background-position: center;
-webkit-background-size: cover;
-moz-background-size: cover;
background-size: cover;
background-repeat: no-repeat;
}在主题的配置文件内 引入创建的的CSS文件
inject:
head:
- <link rel="stylesheet" defer="defer" href="../css/css.css" >
bottom:保存后,刷新博客,就生效了!感谢支持
评论









