#

H1标题颜色

By DoubleSpirit121 1 Views 2 MIN READ 0 Comments
修改 H1 一级标题的颜色样式,打造个性化的页面标题视觉效果。通过 CSS 选择器覆盖 VitePress 默认的标题样式,可以将 H1 标题改为品牌色或其他醒目颜色,增强页面的品牌识别度和视觉层次感。

最简单的修改就是,比如改成红色

/* .vitepress/theme/style/var.css */
.VPDoc h1 {
  color: red;
}

但是这样并不太好看,我们可以弄一个渐变色

/* .vitepress/theme/style/var.css */
.VPDoc h1 {
  background: -webkit-linear-gradient(10deg, #bd34fe 5%, #e43498 15%);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

:::tip
background: 采用了一个线性渐变

background-clip: 使文本的背景颜色与渐变效果相同

text-fill-color:将文字透明
:::

本文由 DoubleSpirit121 原创

采用 CC BY-NC-SA 4.0 协议进行许可

转载请注明出处:https://blog.mcoo.top/index.php/archives/23/

加入 Mcoo

0 评论

发表评论