@font-face
Embed This Widget
Add the script tag and a data attribute to embed this widget.
Embed via iframe for maximum compatibility.
<iframe src="https://fontfyi.com/iframe/glossary/font-face/" width="420" height="400" frameborder="0" style="border:0;border-radius:10px;max-width:100%" loading="lazy"></iframe>
Paste this URL in WordPress, Medium, or any oEmbed-compatible platform.
https://fontfyi.com/glossary/font-face/
Add a dynamic SVG badge to your README or docs.
[](https://fontfyi.com/glossary/font-face/)
Use the native HTML custom element.
A CSS at-rule that allows web designers to specify custom fonts for their web pages. The foundation of web typography.
The @font-face at-rule is the CSS mechanism for loading custom fonts — it registers a font family name and associates it with a source file, so that name can be used throughout your stylesheet. Every custom web font, whether self-hosted or served by Google Fonts or Adobe Fonts, arrives in your CSS through @font-face declarations.
Basic syntax:
@font-face {
font-family: 'Inter';
src: url('/fonts/inter-regular.woff2') format('woff2');
font-weight: 400;
font-style: normal;
font-display: swap;
}
Multiple weights and styles:
Each weight and style variant requires its own @font-face declaration with the same font-family name. The browser matches font-weight and font-style descriptors to select the correct file:
@font-face {
font-family: 'Inter';
src: url('/fonts/inter-regular.woff2') format('woff2');
font-weight: 400;
font-style: normal;
font-display: swap;
}
@font-face {
font-family: 'Inter';
src: url('/fonts/inter-bold.woff2') format('woff2');
font-weight: 700;
font-style: normal;
font-display: swap;
}
@font-face {
font-family: 'Inter';
src: url('/fonts/inter-italic.woff2') format('woff2');
font-weight: 400;
font-style: italic;
font-display: swap;
}
Variable fonts — one declaration replaces many:
@font-face {
font-family: 'Inter';
src: url('/fonts/inter-variable.woff2') format('woff2-variations');
font-weight: 100 900; /* Declares a range */
font-style: normal;
font-display: swap;
}
The font-display descriptor controls FOUT/FOIT behavior:
| Value | Behavior |
|---|---|
auto |
Browser default (usually block) |
block |
Invisible text until font loads (FOIT) |
swap |
Fallback immediately, swap when loaded (FOUT) |
fallback |
100ms block, then swap if loads within 3s |
optional |
100ms block, browser decides whether to swap |
font-display: swap is recommended for most use cases. optional is appropriate when you'd rather the user see system fonts consistently than experience a layout shift.
Unicode range for conditional loading:
@font-face {
font-family: 'MyFont';
src: url('/fonts/myfont-latin.woff2') format('woff2');
unicode-range: U+0000-00FF;
}
The font-family name you declare in @font-face is scoped to your CSS — it doesn't need to match the font's actual name. font-family: 'MyBrandFont' pointing to Inter's files is perfectly valid, though it creates maintenance confusion. By convention, use the font's actual name.
관련 용어
관련 도구
이 개념을 보여주는 폰트
더 알아보기
The complete beginner's guide to adding Google Fonts to your website — using @import, link tags, and the Google Fonts API.
CSS TypographyEverything about @font-face — syntax, format selection, unicode-range subsetting, font-display strategies, and self-hosting vs. CDN.
CSS TypographySelf-hosting Google Fonts gives you full control over loading, privacy, and caching. A step-by-step guide from download to deployment.
CSS TypographyA step-by-step tutorial on using CSS @font-face to load custom fonts — syntax, format selection, and practical examples you can copy-paste.