Unable to successfully use a third font #8276
-
Hey all, I'm using material for mkdocs on my author site and I've used up the two out of the box fonts that can be configured in mkdocs.yml:
and update extra.css to override the font-family in the header and tabs.
That worked as expected. But now I want to use another font and I'm having a tough time with the instructions on how to do so. I added the following font face with the following code in extra.css (I retrieved the url from the google fonts site):
and then attempted to use it in the same file:
I do not see the font being used in the generated site and I do see the following errors from the developer console:
Hoping there is something obvious I am missing. I do see other discussion on how to make deeper modifications to enable this here: But I am hoping for something simpler |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 6 replies
-
Hi @Aazih, src: url("https://fonts.googleapis.com/css2?family=Lancelot&display=swap"); as the URL leads to a text file with CSS font rules, not to a font, so download the text file and include it in your CSS.
--md-text-font: "<font>"; Ref:
Side note, in the past, at Nype, I did have to deal with some issues concerning "invisible text during load", and the issue there was a lack of defined |
Beta Was this translation helpful? Give feedback.
Hi @Aazih,
this is incorrect:
as the URL leads to a text file with CSS font rules, not to a font, so download the text file and include it in your CSS.
You could also use
@import
, but this increases the amount of requests, so I would keep it local in yourextra.css
Also another possible nitpick I would have is you should not usefont-family
unless you're 100% sure that's what you want.Instead, redefine the font variable as described in the docs, you can scope it to the:.md-header
etc. selectors, doesn't have to be:root
Read the comment below for a fixed statement
Ref: