0%

Next7.x主题添加背景图片

打开主题配置文件 themes/next/_config.yml ,搜索找到 custom_file_path ,将下列代码取消注释。

1
style: source/_data/styles.styl

站点根目录

1
mkdir -p source/_data
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
vim source/_data/styles.styl

// 添加背景图片
body {
background: url(https://source.unsplash.com/random/1600x900?wallpapers);//自己喜欢的图片地址
background-size: cover;
background-repeat: no-repeat;
background-attachment: fixed;
background-position: 50% 50%;
}

// 修改主体透明度
.main-inner {
background: #fff;
opacity: 0.8;
}

// 修改菜单栏透明度
.header-inner {
opacity: 0.8;
}