#

引用颜色

By DoubleSpirit121 1 Views 3 MIN READ 0 Comments
自定义 Markdown 引用块(>)的颜色样式,美化引用内容展示。通过 CSS 样式调整,可以让引用块使用品牌色或更具设计感的配色方案,包括边框颜色、背景色和图标样式的定制。

在Markdown中,我们常用的引用符号是>,我们可以稍微改动一下

theme/style新建blockquote.css文件

.
├─ docs
│  ├─ .vitepress
│  │  └─ config.mts
│  │  └─ theme
│  │     └─ style
│  │        └─ index.css
│  │        └─ blockquote.css
│  └─ index.md
└─ node_modules

复制下面代码,粘贴到blockquote.css

/* .vitepress/theme/style/blockquote.css */
.vp-doc blockquote {
    border-radius: 10px;
    padding: 18px 20px 20px 15px;
    position: relative;
    background-color: var(--vp-c-gray-soft);
    border-left: 6px solid var(--vp-c-green-2);
}

然后在index.css中引入生效

/* .vitepress/theme/style/index.css */
@import './blockquote.css';

本文由 DoubleSpirit121 原创

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

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

加入 Mcoo

0 评论

发表评论