I'm creating a website and I'm trying to change the default font, but even if it seems that it's being loaded correctly (I see no loading errors even on other's computers) all I get on the page is the default one. This is the CSS code I use to load the fonts:
@font-face {
font-family: "Fira Code";
src: URL("../fonts/FiraCode-Regular.woff2") format('woff2'),
URL("../fonts/FiraCode-Regular.woff") format('woff'),
URL("../fonts/FiraCode-Regular.ttf") format('truetype');
}
The font is then called:
body {
font-family: "Fira Code";
}
For reference, the structure of the website folder is:
website-folder
|- index.html
|- css
| |- style.css
|- fonts
| |- FiraCode-Regular.woff2
| |- FiraCode-Regular.woff
| |- FiraCode-Regular.ttf
I've tried calling font-family on a singular element as well but it didn't work.
As seen from another question, I've added at the beginning of every CSS file this code, but still no luck:
*= require fonts
The CSS files are different between the mobile and computer versions of the website, but they are in the same folder so the font code is identical. The terminal CSS is separate as well. I'm using this API, so I've downloaded the CSS locally and modified the font-family in it, but nothing.
I've tried using the GitHub font links as the URLs in the font-face - which I made sure are working - but it still didn't work.
Another weird thing is that after trying to solve this issue for a couple of hours the font shows up on the website, but not on the mobile HTML, and if I try to load it from another computer it's showing the default font.
I've tried looking at several other questions on the issue, but none helped me solved my problem. I really hope that anyone can help me! Thanks in advance :-)
EDIT: I messed up relative directories by writing ./fonts/FiraCode-Regular.woff2
instead of ../fonts/FiraCode-Regular.woff2
, but now even with the fixed code the font still won't show up.
EDIT II: The problem, in the end, was the *= require fonts
code I added to the beginning of every CSS file as seen in an answer to another question. I don't know why it stopped the fonts from being loaded, but thanks to everyone that helped me with the first edit as well! Without it 100% it wouldn't have worked the same.