友链一行显示多个
请先一步完成
友链样式魔改
- 在自定义css中添加以下代码其中,
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/* 友链一行显示更多 */
.site-card {
width: calc(100% / 5 - 16px) ;
border-radius: 18px ;
}
.site-card .img {
height: 165px ;
border-radius: 18px ;
}
/* 适应宽度不同的设备 */
@media screen and (max-width: 1200px) {
.site-card {
width: calc(100% / 4 - 16px) ;
}
}
@media screen and (max-width: 900px) {
.site-card {
width: calc(100% / 3 - 16px) ;
}
}
@media screen and (max-width: 600px) {
.site-card {
width: calc(100% / 2 - 16px) ;
}
}width: calc(100% / 5 - 16px) !important;
的5可以更改成更多,宽度按自己喜欢的样式进行修改 - 博客宽屏适配
在custom.css
中加入以下样式:1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18/* 全局宽度 */
.layout {
max-width: 1400px;
}
/* 侧边卡片栏宽度 */
.aside-content {
max-width: 318px;
min-width: 300px;
}
/* 平板尺寸自适应(不启用侧边栏宽度限制) */
@media screen and (max-width: 900px) {
.aside-content {
max-width: none ;
padding: 0 5px 0 5px;
}
} - 因为以上代码有重复,也可以复制下面的整合版:
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/* 友链卡片布局优化 */
.site-card {
width: calc(100% / 5 - 16px) ;
border-radius: 18px ;
}
.site-card .img {
height: 165px ;
border-radius: 18px ;
}
/* 响应式布局调整 */
@media screen and (max-width: 1200px) {
.site-card {
width: calc(100% / 4 - 16px) ;
}
}
@media screen and (max-width: 900px) {
.site-card {
width: calc(100% / 3 - 16px) ;
}
/* 平板尺寸侧边栏调整 */
.aside-content {
max-width: none ;
padding: 0 5px;
}
}
@media screen and (max-width: 600px) {
.site-card {
width: calc(100% / 2 - 16px) ;
}
}
/* 全局布局设置 */
.layout {
max-width: 1400px;
}
/* 侧边栏默认样式 */
.aside-content {
max-width: 318px;
min-width: 300px;
} - 有的小伙伴想友链页面不显示侧边栏,可以在主题文件中aside部分增加一项增加flink: false
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25aside:
enable: true
hide: false
# Show the button to hide the aside in bottom right button
button: true
mobile: true
# Position: left / right
position: right
display:
archive: true
tag: true
category: true
flink: false # 友链页隐藏侧栏
这样友链页面就不会显示侧边栏了
本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来源 mccsjs🍋の小家!
评论