CSS魔改记录
发表于|更新于
butterfly为主题的基础下进行修改
嵌入方法
在“博客根目录\themes\butterfly\source\css”下新建CSS文件
打开主题配置文件,在head下方写入
1
| - <link rel="stylesheet" href="/css/CSS文件的文件名.css">
|
例如
1 2 3 4 5
| inject: head: - <link rel="stylesheet" href="/css/partbackground.css"> - <link rel="stylesheet" href="/css/background.css">
|
模块半透明
方法一:嵌入CSS
缺点:不适用于暗黑模式
1 2 3 4 5 6 7 8 9
| #recent-posts>.recent-post-item,.layout>div:first-child:not(.recent-posts),.layout_post>#page,.layout_post>#post,.read-mode .layout_post>#post { background: rgba(255,255,255,.9); } #aside-content .card-widget { background: rgba(255,255,255,.9); }
|
方法二:修改主题文件
diff 代码块仅做色块标记,删除 +、- 号之后记得补全空格,调整缩进。
[Blogroot]\themes\butterfly\source\css\var.styl
1 2
| - $card-bg = $white + $card-bg = rgba(255,255,255,.85)
|
[Blogroot]\themes\butterfly\source\css\_mode\darkmode.styl
1 2
| - --card-bg: #121212 + --card-bg: rgba(0,0,0,.5)
|
全屏图片背景
此部分内容有误,待修改
修改主题配置文件
嵌入CSS文件
1 2 3 4 5 6 7 8 9 10
| #web_bg { background: url('https://gitee.com/jshahezy/blogs/raw/master/res/5005df7fec55a8b4980d0426566114f8c64df94a-min.webp'); background-repeat: no-repeat; background-size: cover; background-position: center; }
|
半透明底部
方法一:嵌入CSS
缺点:不适用于暗黑模式
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
| #footer { background: rgba(255,255,255,.15); color: #000; border-top-right-radius: 20px; border-top-left-radius: 20px; backdrop-filter: saturate(100%) blur(5px) }
#footer::before { background: rgba(255,255,255,.15) }
#footer #footer-wrap { color: rgb(254, 44, 131) }
#footer #footer-wrap a { color: rgb(254, 44, 131) }
|
方法二:修改主题文件
diff 代码块仅做色块标记,删除 +、- 号之后记得补全空格,调整缩进。
[Blogroot]\themes\butterfly\source\css\var.styl
1 2
| 在":root"下添加 + --foot-front: #FE2C83 !important
|
[Blogroot]\themes\butterfly\source\css\_mode\darkmode.styl
1 2
| 在 [data-theme='dark'] 下添加 + --foot-front: rgba(255,255,255,0.7) !important
|
嵌入CSS
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
| #footer { background: rgba(255,255,255,.15); color: #000; border-top-right-radius: 20px; border-top-left-radius: 20px; backdrop-filter: saturate(100%) blur(5px) }
#footer::before { background: rgba(255,255,255,.15) }
#footer #footer-wrap { color: var(--foot-front) }
#footer #footer-wrap a { color: var(--foot-front) }
|
引入阿里矢量图标库
参考Hexo-使用阿里iconfont图标 即可,篇幅原因不再说明。