Skip to content

Easy way to change the font to local file via CSS #66

Answered by nunocoracao
stamyx asked this question in Q&A
Discussion options

You must be logged in to vote

Hello @stamyx , to replace the font you should do 2 things:

  1. place the font in the static folder as you've done, I would also place it within a folder called fonts.
  2. create a custom.css file so that you can override the stylesheet, final structure will look like this:
.
├── assets
│   └── css
│       └── custom.css
...
└─── static
    └── fonts
        └─── font.ttf
  1. import the new font using the newly created custom.css and apply it to the elements you wish (example below does it for html):
@font-face {
    font-family: font;
    src: url('/fonts/font.ttf');
}

html {
    font-family: font;
}

After your suggestion I've also added these instructions to the docs

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Answer selected by nunocoracao
Comment options

You must be logged in to vote
1 reply
@nunocoracao
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants