# 在 Brand Header Theme 中更改页眉字体时遇到问题

**URL:** https://meta.discourse.org/t/trouble-changing-header-font-in-brand-header-theme/159697
**Category:** Support
**Created:** [2020年八月3日 19:02 UTC](https://meta.discourse.org/t/trouble-changing-header-font-in-brand-header-theme/159697 "2020-08-03T19:02:48Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Daniel\_Wallace](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/daniel_wallace/32/188803_2.png) [@Daniel\_Wallace](https://meta.discourse.org/u/Daniel_Wallace)
#### Post date: [2020年八月3日 19:02 UTC](https://meta.discourse.org/t/trouble-changing-header-font-in-brand-header-theme/159697/1 "2020-08-03T19:02:48Z")

</div>

我安装了品牌页头主题组件。效果很棒！现在我想将标题文本更改为我品牌的字体 Harman Sans。

- 我已上传了该字体文件。
- 当我尝试修改 CSS 时，文本似乎显示异常。

我在论坛的其他地方看到了关于使用自定义字体的说明，但我不确定应该将这些说明中的不同组件放在哪里。

我正在查看我的 CSS，但不确定要编辑哪些部分：

`@import "theme_variables";`

```
    .b-header {
      width: 100%;
      background-color: $tertiary;
      height: 48px;
      margin-bottom: 0;

      .contents {
        margin: 8px 0;
      }

      .title {
        float: left;
        margin-right: 24px;
        a {
          color: $secondary;
        }
        &:visited {
          color: $secondary;
        }
        .rtl & {
          float: right;
          margin-left: 24px;
          margin-right: 0;
        }
      }

```

---

<div class="post-metadata">

### Author: ![IAmGav](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/iamgav/32/235598_2.png) [@IAmGav](https://meta.discourse.org/u/IAmGav)
#### Post date: [2020年八月3日 19:19 UTC](https://meta.discourse.org/t/trouble-changing-header-font-in-brand-header-theme/159697/2 "2020-08-03T19:19:48Z")

</div>

如果你查看 Material Design 主题对应的 CSS 代码，就会看到他们在字体上做了哪些处理。

---

<div class="post-metadata">

### Author: ![Daniel\_Wallace](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/daniel_wallace/32/188803_2.png) [@Daniel\_Wallace](https://meta.discourse.org/u/Daniel_Wallace)
#### Post date: [2020年八月3日 20:54 UTC](https://meta.discourse.org/t/trouble-changing-header-font-in-brand-header-theme/159697/3 "2020-08-03T20:54:06Z")

</div>

我刚看了一下，非常干净！但我觉得我做不到——我没有使用 Google 字体。我必须将字体作为资源上传（我已经做了），然后将其指向页眉。

我试图理解这条建议：[Include assets (e.g. images, fonts) in themes and components](https://meta.discourse.org/t/include-images-and-fonts-in-themes-and-components/62459)

内容很详细！只是我不知道应该把这些文本片段放在哪里。

---

<div class="post-metadata">

### Author: ![IAmGav](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/iamgav/32/235598_2.png) [@IAmGav](https://meta.discourse.org/u/IAmGav)
#### Post date: [2020年八月4日 09:27 UTC](https://meta.discourse.org/t/trouble-changing-header-font-in-brand-header-theme/159697/4 "2020-08-04T09:27:30Z")

</div>

将其放入您的主题 CSS 中，并在上传时使用该名称。

命名方式如下图所示

 ![上传的字体](https://global.discourse-cdn.com/meta/original/3X/e/d/ed9aa991243ef772913cbbf803eba2aa0195e1c6.png)

---

<div class="post-metadata">

### Author: ![Daniel\_Wallace](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/daniel_wallace/32/188803_2.png) [@Daniel\_Wallace](https://meta.discourse.org/u/Daniel_Wallace)
#### Post date: [2020年八月4日 16:22 UTC](https://meta.discourse.org/t/trouble-changing-header-font-in-brand-header-theme/159697/5 "2020-08-04T16:22:08Z")

</div>

我之前把说明理解得太字面了。现在它起作用了！再次感谢！

 ![](https://media.tenor.com/videos/cabfec7a6aec478161774caa307cf02c/mp4)
