# Is this the right way to set custom font?

**URL:** <https://discourse.gohugo.io/t/is-this-the-right-way-to-set-custom-font/35071>\
**Category:** support\
**Created:** [October 9, 2021, 1:59pm UTC](https://discourse.gohugo.io/t/is-this-the-right-way-to-set-custom-font/35071 "2021-10-09T13:59:51Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![podstanar](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/podstanar/32/15360_2.png) [@podstanar](https://discourse.gohugo.io/u/podstanar)\
**Post date:** [October 9, 2021, 1:59pm UTC](https://discourse.gohugo.io/t/is-this-the-right-way-to-set-custom-font/35071/1 "2021-10-09T13:59:52Z")

</div>

I have a font in `/static/font/input_regular.ttf` that i want to use for _code_ tags, and i have this in my **styles.css** :

```auto
@font-face {
  font-family: "Input_reg";
  src: url("/font/input_regular.ttf") format("truetype");
}

pre, code {
  font-family: "Input_reg", monospace;
  font-size: inherit;
}

```

It doesn’t work, what am i doing wrong here?

---

<div class="post-metadata">

**Author:** ![jhvanderschee](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/jhvanderschee/32/18241_2.png) [@jhvanderschee](https://discourse.gohugo.io/u/jhvanderschee)\
**Post date:** [October 9, 2021, 2:18pm UTC](https://discourse.gohugo.io/t/is-this-the-right-way-to-set-custom-font/35071/2 "2021-10-09T14:18:46Z")

</div>

It should work, but if it does not, I would try to use the WOFF format.

---

<div class="post-metadata">

**Author:** ![Mehedi](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/mehedi/32/12392_2.png) [@Mehedi](https://discourse.gohugo.io/u/Mehedi)\
**Post date:** [October 10, 2021, 4:17am UTC](https://discourse.gohugo.io/t/is-this-the-right-way-to-set-custom-font/35071/3 "2021-10-10T04:17:08Z")

</div>

For web font, you should use `woff` /`woff2` format. you can convert your `.ttf` font into `woff` from here [Font Squirrel | Create Your Own @font-face Kits](https://www.fontsquirrel.com/tools/webfont-generator). and they will also provide you the CSS you need to attach.

---

<div class="post-metadata">

**Author:** ![system](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/system/32/1_2.png) [@system](https://discourse.gohugo.io/u/system)\
**Post date:** [October 17, 2021, 9:04pm UTC](https://discourse.gohugo.io/t/is-this-the-right-way-to-set-custom-font/35071/4 "2021-10-17T21:04:49Z")

</div>

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.
