Using Google Fonts
Google Fonts provides hundreds of free, open-source typefaces served from Google's global CDN. Loading them correctly avoids layout shift and performance regressions.
Embedding via Link
Add a <link> element in your HTML <head>. Use rel="preconnect" hints to start the DNS handshake early.
Subset and Weight Selection
Only request the weights and character subsets you actually use. Requesting every weight bloats the download unnecessarily.
CSS @import (Avoid)
Using @import inside CSS delays font loading — the browser must first download the CSS, then discover and download the font. Prefer the HTML <link> approach.
font-display: swap
Append &display=swap to the Google Fonts URL to use font-display: swap, preventing invisible text during font load.