lxgw

在 PaperMod 博客中设置自定义字体

下载字体 下载你需要的字体,并存储在 static/fonts 导入字体 @font-face { font-family: "LXGWWenKai-Regular"; src: url("/fonts/lxgw-wenkai/LXGWWenKai-Regular.ttf") format("truetype"); } 应用字体 body { font-family: LXGWWenKai-Regular; } 在 PaperMod 中应用 把你自己的 css 文件文件放在 assets/css/extended/custom_fonts.css 导入多字重的字体文件 @font-face { font-family: "LXGWWenKai"; src: url("/fonts/lxgw-wenkai/LXGWWenKai-Light.ttf") format("truetype"); font-weight: lighter; font-style: normal; } @font-face { font-family: "LXGWWenKai"; src: url("/fonts/lxgw-wenkai/LXGWWenKai-Regular.ttf") format("truetype"); font-weight: normal; font-style: normal; } @font-face { font-family: "LXGWWenKai"; src: url("/fonts/lxgw-wenkai/LXGWWenKai-Bold.ttf") format("truetype"); font-weight: bold; font-style: normal; } 使用 CDN @import url('https://cdn.jsdelivr.net/npm/jetbrains-mono@1.0.6/css/jetbrains-mono.min.css'); code { font-family: 'JetBrains Mono'; } 参考链接 Sulv’s Blog - Hugo博客自定义字体 PaperMod - FAQs StackOverflow - Using custom fonts using CSS?...

三月 2, 2023 · Aimer Neige