20

Use system fonts to make your site load faster

 4 years ago
source link: https://jlelse.blog/dev/system-fonts/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Although it's great to self-host your web fonts instead of using a service like Google Fonts (that may decrease the privacy of your site's visitors, because Google can log IP addresses and other stuff), it's probably not necessary to use web fonts at all. Every PC or tablet or phone has a lot of fonts already pre-installed, which are more than perfect for displaying your website (unless you take a lot of care about corporate design or your personal brand and require a specific font).

For example, I use the following CSS font-family property in my blog and website theme ( view the stylesheet ):

font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;

This uses the default sans-serif fonts on macOS, some Linux distributions and Windows. And if none of them are available, it uses the default sans-serif font chosen by the web browser.

No font files are downloaded when you open my blog. It doesn't need additional HTTP-requests, bandwidth or cache and no font CDN can log your IP address, browser version or other information your browser sends with every request. Additionally the page loads a little bit faster.

You can read more about system fonts here .


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK