HUGO

Is this the right way to set custom font?

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:

@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?

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

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. and they will also provide you the CSS you need to attach.

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