AirboZH / halo-theme-chirpy

一个Halo生态,简约且功能丰富的技术博客主题。A minimal, responsive and feature-rich Halo theme for technical writing.
https://halo.run/store/apps/app-vGuQB
MIT License
85 stars 22 forks source link

如何修改字体? #127

Closed GD2021 closed 10 months ago

GD2021 commented 10 months ago

如何修改全局的字体呢?


见:https://github.com/AirboZH/halo-theme-chirpy/issues/127#issuecomment-1832987582

AirboZH commented 10 months ago

您好,目前主题不支持修改全局字体。 如果有条件可以自己下载源码,修改css代码,编译后使用。 或者这个情况如果需求比较大的话,我可以更新使字体可以通过配置自定义。

AirboZH commented 10 months ago

您可以先提供想要替换的字体,我考虑一下~

Waite0603 commented 10 months ago

如何修改全局的字体呢?

也可以在 Halo 后台 -> 设置 -> 代码注入 -> 全局 自行植入 CSS 以下是一个示例, 可以根据自己的需求自行修改!

<!--引入字体-->
<link rel="stylesheet" href="https://npm.elemecdn.com/lxgw-wenkai-webfont@1.1.0/lxgwwenkai-regular.css" />

<style>
  /*全局字体*/
  * {
    font-family: LXGW WenKai;
    font-weight: bold;
  }
</style>
GD2021 commented 10 months ago

感谢!!

GD2021 commented 10 months ago

image 为何标题不生效呢?

AirboZH commented 10 months ago

为何标题不生效呢?

可以提供站点我看一下么

GD2021 commented 10 months ago

https://pastebin.com/raw/ugSyTaR3 您费心了

GD2021 commented 10 months ago
<!-- 引入字体 -->
<link rel="stylesheet" href="https://npm.elemecdn.com/lxgw-wenkai-webfont@1.1.0/lxgwwenkai-regular.css" />

<style>
  /* 全局字体 */
  * {
    font-family: 'LXGW WenKai', sans-serif;
  }

  /* 标题字体 */
  h1, h2, h3, h4, h5, h6 {
    font-family: 'LXGW WenKai', sans-serif;
    font-weight: bold; /* 为标题设置加粗 */
  }
</style>

修改了一下,好了。