Importing Custom Fonts (CSS)
Hello,
I'm trying to import a custom font for my project.
This currently works, but when I switch to an '.otf' file, the font doesn't import. Does anyone know how to fix this?
7 Replies
For reference, the font comes with these docs:
I've imported these files as well and referenced
font-family: 'the_hometownregular'
, but still no fix.Joy Of Code
Best Practices When Using Fonts
Everything I know about best practices when using fonts on the web.
that second screen shot I think the name should still be the name
font-family: 'Hometown';
🤔Hi, this is the CSS i used in my latest project for custom fonts and it works:
Font with OTF example:
Font with TTF example:
And you specify it as font-family: 'FontA' or font-family: 'FontB'.
If you have woff and woff2, they are prefered option over otf/ttf for web.
Edit: FontA and FontB are made up names, not actual font family names
@kikky1902That is basically the same thing I'm doing
My example works with another font but not with this font for some reason
The issue was:
format('ttf');
should be format('truetype')