惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

博客园_首页
Hacker News: Ask HN
Hacker News: Ask HN
V
Visual Studio Blog
Hugging Face - Blog
Hugging Face - Blog
博客园 - 【当耐特】
I
InfoQ
A
About on SuperTechFans
宝玉的分享
宝玉的分享
Project Zero
Project Zero
C
CXSECURITY Database RSS Feed - CXSecurity.com
量子位
The Register - Security
The Register - Security
大猫的无限游戏
大猫的无限游戏
Blog — PlanetScale
Blog — PlanetScale
Simon Willison's Weblog
Simon Willison's Weblog
C
Cyber Attacks, Cyber Crime and Cyber Security
T
The Exploit Database - CXSecurity.com
Cyberwarzone
Cyberwarzone
L
LINUX DO - 热门话题
博客园 - 聂微东
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
P
Privacy International News Feed
T
Tenable Blog
博客园 - 叶小钗
P
Palo Alto Networks Blog
S
Securelist
F
Full Disclosure
Help Net Security
Help Net Security
爱范儿
爱范儿
Cisco Talos Blog
Cisco Talos Blog
F
Fortinet All Blogs
Google DeepMind News
Google DeepMind News
IT之家
IT之家
S
Secure Thoughts
Martin Fowler
Martin Fowler
The Cloudflare Blog
阮一峰的网络日志
阮一峰的网络日志
小众软件
小众软件
G
GRAHAM CLULEY
J
Java Code Geeks
Forbes - Security
Forbes - Security
Application and Cybersecurity Blog
Application and Cybersecurity Blog
A
Arctic Wolf
L
LangChain Blog
Webroot Blog
Webroot Blog
TaoSecurity Blog
TaoSecurity Blog
月光博客
月光博客
T
The Blog of Author Tim Ferriss
Engineering at Meta
Engineering at Meta
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知

蛇年大吉

通过json生成talk-card | 蛇年大吉 通过json生成site-card | 蛇年大吉 通过json生成图片集 | 蛇年大吉 如何更新主题 | 蛇年大吉 netlify部署博客 | 蛇年大吉 增加获取图片标签 | 蛇年大吉 关于我页面写法 | 蛇年大吉 markdown样式优化 | 蛇年大吉 音乐播放器失效问题 | 蛇年大吉 新增酷炫按钮和预加载动画 | 蛇年大吉 首页github日历 | 蛇年大吉 轮播-swiper | 蛇年大吉 主题config配置项简介 | 蛇年大吉 首页添加弹幕 | 蛇年大吉 制作简历(关于我)和404页面 | 蛇年大吉 自定义live2d | 蛇年大吉 自定义css之导航和页脚高斯模糊 | 蛇年大吉 给bamboo添加动态背景 | 蛇年大吉 给bamboo添加右上角梅花 | 蛇年大吉
自定义css之头部图片透明 | 蛇年大吉
作者: YuAng · 2022-06-09 · via 蛇年大吉

其实我们是可以自定义css的,例如我把文章详情页上面文章名称后面的背景变透明,也是可以办到的。
如图所示:
头部透明

步骤如下:
首先说明:下面的source文件夹和主题themes文件夹同级,也就是最外面(根目录下)的那个source文件夹,不是主题里的,这样就不会动源码

  1. 首先我们在source文件夹下创建custom/index.css, 内容如下:
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    .post-detail-header {
    background-image: none!important;
    background-color: transparent!important;

    }
    .post-detail-header-mask {
    background: transparent!important;
    }
    #appBgSwiper {
    filter: brightness(0.8);
    background: rgba(0, 0, 0, .3)!important;
    }
    这里的!important就是权重值更高的意思。

2.引入我们创建好的css
打开主题配置文件_config.yml, 找到import, 引入css

1
2
3
4
5
6
7
8
9

import:
link:
- <link href="/custom/index.css" rel="stylesheet">
-
script:

-
-

背景图片则使用参数bgImg指定, 例如:

1
2
3
4
5
6
7
8
9
---
title: 自定义css之头部图片透明
date: 2022-06-09 18:56:20
tags: ['自定义css']
categories: [自定义css]
swiper: true
img: https://pic1.zhimg.com/80/v2-6d0cbd4380b4959542d3f5da31c7f20c_1440w.jpg
bgImg: https://pic1.zhimg.com/80/v2-6d0cbd4380b4959542d3f5da31c7f20c_1440w.jpg
---

bgImg还可以是数组哦,数组的话额背景图片轮播显示, 例如:

1
2
3
4
5
bgImg: [
'https://pica.zhimg.com/80/v2-292e6340491bd97f9d014d6be3371c04_1440w.jpg',
'https://pica.zhimg.com/80/v2-9659f2305acb80f25ced33aa980092c1_1440w.jpg',
'https://api.btstu.cn/sjbz/api.php',
]

bgImg不仅可以在文章里面单独配,还可以在主题配置文件里面全局指定。

1
bgImgTransition: 'fade' # fade, scale, translate-fade,

bgImgTransition表示背景图片切换特效, 可以在单独文章页面使用,也可以在主题配置文件里面全局指定。

然后就ok啦,大功告成

这个效果还可以和添加动态背景效果一起使用哦