The @font-face at-rule registers a custom font face for your page. You give it a family name and a source, then use that name with font-family.
Sources can be a file URL (url()) or a font installed on the device (local()). Prefer WOFF2 for downloaded fonts. Always keep a fallback stack so text stays readable if the file fails.
Baseline Widely available.
Standard CSS Fonts feature. Required descriptors: font-family and src. Optional helpers include font-weight, font-style, and font-display.
Reuse the family name. Both faces share "StudySans".
Tag each file.font-weight: 400 and 700 pick the right face.
Style with weight.font-weight: 700 selects the bold face.
Avoid fake bold. Mapping real files looks cleaner than synthetic bolding.
Edge Cases & Pitfalls
Most font bugs are naming, path, or missing-fallback issues.
required
Need both font-family and src
Without those two descriptors, the @font-face rule is invalid.
name
Names must match exactly
The string in @font-face and in font-family must match, including quotes and spelling.
path
Check the font URL
A wrong path or CORS block means the browser falls back to the next font in the stack.
fof
Flash of invisible/unstyled text
Use font-display: swap (or similar) so users see text while the file loads.
license
Respect font licenses
Only host fonts you are allowed to redistribute on the web.
Compatibility
Browser Support
@font-face is a browser CSS feature for loading font faces. Node.js, Deno, and Bun do not apply it as a layout API.
✓ Baseline · Widely available since 2015
@font-face
Supported in Chrome, Firefox, Safari, Edge, Opera, and Samsung Internet. WOFF2 is supported in all modern browsers.
98%Modern browsers
Google ChromeYes
Full support
Mozilla FirefoxYes
Full support
Apple SafariYes
Full support
Microsoft EdgeYes
Full support
OperaYes
Full support
Samsung InternetYes
Full support
Internet Explorer9+
Partial (older formats)
@font-faceWidely supported
Bottom line: Safe for modern sites with WOFF2. Prefer font-display: swap and always include fallbacks. Not a server runtime API.
Remember
Key Takeaways
Role: register a custom font face with a name and a source.
Required:font-family + src. Prefer WOFF2 for downloads.
Apply: use the same name in the font-family property with fallbacks.
Tip:font-display: swap keeps text visible while the font loads.
One line:@font-face names a font source; font-family applies that name to your text.
Frequently Asked Questions
It registers a custom font face. You set a font-family name and a src (local or url). Then use that name with the font-family property like any other font.
font-family and src are required for a valid @font-face rule. Other descriptors such as font-weight, font-style, and font-display are optional.
WOFF2 is the best default for modern browsers. You can list older formats after it so more browsers have a fallback file.
It shows fallback text right away, then swaps to the custom font when the file is ready. That keeps text readable during loading.
Browsers try sources in order. Put local() first to use an installed font when available, then url() to download a web font if needed.
It is Baseline and widely available since 2015 in Chrome, Firefox, Safari, Edge, and Opera. It is a browser CSS feature, not a Node.js API.