hexo+next博客美化——自定义样式


本章概述:hexo+next博客美化——自定义样式


我们调整样式的时候也不要直接操作next主题下的样式文件,将自定义文件与主题文件分开无疑是个很好的选择,我们在博客目录下的source新增一个_data目录,在该目录下新建styles.styl,这个文件将存放我们自定义的样式,然后在备用主题配置文件中custom_file_path选项里面讲style那一行取消注释。以下样式作参考,需要的大佬可以拷贝过去自行尝试!

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
//背景图片
body {
background :url(https://xxxx);
height:100%;
width:100%;
background-repeat:repeat-x;
background-attachment:fixed;
background-size:100% 100%;
}
//首页文章描述
blockquote p{
font-size: 16px;
}
//阅读全文按钮样式
.post-button .btn{
color: #555 !important;
background-color: rgb(255, 255, 255);
border-radius: 3px;
font-size: 15px;
box-shadow: inset 0px 0px 10px 0px rgba(0,0,0,0.35);
border: none !important;
transition-property: unset;
padding: 0px 15px;

}
.post-button .btn:hover{
color: rgb(255,255,255) !important;
border-radius: 3px;
font-size: 15px;
box-shadow: inset 0px 0px 10px 0px rgba(0,0,0,0.35);
background-image: linear-gradient(90deg,#5587CE 0%,#21487a 25%,#3537a5 50%,#21487a 75%,#5587CE 100%);


}
//修改链接选中样式
a,span.exturl{
border-bottom: none;
&:hover {
color: #ff106c;
}
}



//修改选中字符的颜色
::selection {
background: #26a69a;
color: #ffffff;
font-weight: 900;
font-size: 32px;
}
::-moz-selection {
background: #26a69a;
color: #ffffff;
font-weight: 900;
font-size: 32px;
}


//去掉顶部黑线
.headband{
display: none;
}

//修改选中字符的颜色
::selection {
background: #26a69a;
color: #ffffff;
font-weight: 900;
font-size: 32px;
}
::-moz-selection {
background: #26a69a;
color: #ffffff;
font-weight: 900;
font-size: 32px;
}

//博客内容透明化
//菜单栏的透明度设置
.header .header-inner {
background: rgba(255,255,255,0.85);
margin-top: 20px;
overflow: hidden;
}
//文章内容的透明度设置
.main-inner {
opacity: 0.9;
}
//侧边框的透明度设置
.sidebar {
background rgba(255,255,255,0)
}
.sidebar-inner{
background: rgba(255,255,255,0.85);
}

.site-brand-container{

opacity: 0.8;
}

//页面内容框样式
.post-block{
margin-top: 40px;
margin-bottom: 30px;
margin-left: 20px;
}

hr{
margin-top: 10px;
margin-bottom: 10px;
}
.posts-expand .post-meta {
margin-bottom: 10px;
}

.back-to-top{
background: rgba(255,255,255,0)
}


//标签页面样式
.tag-cloud a{
box-shadow: 0 1px 3px #5587CE,0 1px 2px #5587CE;
padding: 2px 10px;
margin: 8px;
background: rgba(193, 66, 92, 0);
border-bottom: none;
border-radius: 20px;

}

// 分类&&标签 页面样式
.post-block.page {
margin-top: 40px;
}

.category-list {
overflow: auto;
}
.category-list li {
height: 100%;
float: left;
border-right: 3px solid #222;
padding: 0 20px;
}
.category-list li a:hover {
color: black;
}
.category-list li.active a {
font-weight: bold;
color: black;
}
//页脚文字颜色
.footer-inner{

color: #ffffff;
}

样式大概就这些,这些在我博客已经是调整好的了,但是我不敢保证在其他的博客网站上可以完全正常,所以拷贝的话需要做测试才行!