只有代码的世界 2020-04-27
打开文档下themes\next\source\css\ _custom\custom.styl文件,这个是Next故意留给用户自己个性化定制一些样式的文件,添加以下代码:(先在...\themes\next\source\images路径下添加一个背景图片banner.jpg)
// Custom styles.body { background:url(/images/banner.jpg); background-repeat: no-repeat; background-attachment:fixed; background-position:50% 50%; background-size: 100% 100%;}打开站点配置文件:站点根目录/_config.yml
修改成中文显示和标题名字:(支持的文字类型可以在该主题下\themes\next\languages,language文件夹下查看,简体中文zh-Hans,其它主题可能是zh-CH)
# Site title: iBoundary subtitle: ‘‘ description: ‘‘ keywords: author: iBoundary language: zh-Hans timezone: ‘‘
全部代码:(themes\next\source\css\ _custom\custom.styl)
// Custom styles.//底部字体颜色
.footer-inner {color: #7FFFD4;}//全局背景图
body {
//background:url(/images/banner.jpg);
//background-repeat: no-repeat;
//background-attachment:fixed;
//background-position:50% 50%;
//background-size: 100% 100%;
}
//侧栏背景图和字体颜色
#sidebar {
background:url(/images/banner.jpg);
background-size: cover;
background-position:center;
background-repeat:no-repeat;
p,span,a {color: #1C1C1C;}
}//设置文章边框
.post {
margin-top: 60px;
margin-bottom: 60px;
padding: 25px;
-webkit-box-shadow: 0 0 5px rgba(202, 203, 203, .5);
-moz-box-shadow: 0 0 5px rgba(202, 203, 204, .5);
}修改完上面操作时需要刷新才能生效:
$ hexo clean && hexo g && hexo s$ hexo d #确认没问题再执行这个