How to correctly import fonts

Hey, if I have some @font-face declarations inside of a css file and import the css file in the html, I understand that this shouldn’t cause a problem because the assets wouldn’t load sequentially since they’re being imported through the html, thus not blocking the page render if it takes too long, but should I be importing fonts using a different method? Perhaps a link tag if that exists for this? If so, how do i still get the benefits of @font-face? Thanks in advance
6 Replies
✫𝕽𝖆𝖌𝖊𝖗 ✫
If you're using custom fonts, @font-face gives you more control, and it’s fine to include it in a CSS file. For web fonts like Google Fonts, use the <link> tag for simplicity and faster setup. You can also combine both methods—preload the font with <link> and define it with @font-face to optimize loading times.
Lamer of Sweden
I like this article that explains three parts regarding performance best practice for fonts. https://web.dev/articles/font-best-practices
web.dev
Best practices for fonts  |  Articles  |  web.dev
Learn about how to optimize web fonts for Core Web Vitals.
b1mind
b1mind3w ago
Joy of Code
Best Practices When Using Fonts
Everything I know about best practices when using fonts on the web.
b1mind
b1mind3w ago
Another resource
ἔρως
ἔρως3w ago
and remember: self-host your fonts or use a google fonts alternative
snxxwyy
snxxwyyOP3w ago
Thanks for the input everyone, I’ll get to reading the articles
Want results from more Discord servers?
Add your server