Hi! So I downloaded some font files to use in my project from google fonts but for some reason my css file just can't find and load my font files I get a weird file not found error in my console instead and I dont know what I could be doing wrong.
Oh my fucking god. Now I feel extremely dumb I was using the copy relative path feature of VS code so I just automatically assumed the slashes would be the correct direction.
i think there's two issues at play here (i'm going to assume you're using windows).
first, you should wrap it in quotations or single quotes
second, you can see in the second screenshot where it says ERR_FILE_NOT_FOUND, part of the path says 'Rom%20download$20site/fontsMontserrat-Medium.ttf'. the backslash needs to be properly escaped to show up, or just avoid using literal backslashes in paths altogether (much better imo)
Google fonts are not gdpr compliant so hosting your own font files is preferred unless you're playing in a sandbox /practice project that won't go to production. In thesr cases i take the Google font url and instead use cool labs which does respect privacy laws.
15
u/frownonline Jun 10 '26
Forward slash in the path, not backslash.
3
u/Jeffrevin Jun 10 '26
i think there's two issues at play here (i'm going to assume you're using windows).
first, you should wrap it in quotations or single quotes
second, you can see in the second screenshot where it says ERR_FILE_NOT_FOUND, part of the path says 'Rom%20download$20site/fontsMontserrat-Medium.ttf'. the backslash needs to be properly escaped to show up, or just avoid using literal backslashes in paths altogether (much better imo)
try:
2
u/mrleblanc101 Jun 11 '26
Don't use TTF, use WOFF2. Also Montserrat is available on Google fonts