at-rule

@font-face — CSS reference

Defines an available font face with a family name, resource candidates and matching/display descriptors. It does not style elements until they request the family. The example uses a locally installed font; on other systems it falls back to sans-serif. For a deployed web font use a licensed resource and a suitable loading policy.

Formal Syntax & Structure

css syntaxcss
@font-face { font-family: <family-name>; src: <font-src-list>; /* optional descriptors */ }

Working Example

Example Snippetcss
<!doctype html><html lang="en"><meta charset="utf-8"><title>CSS font lab</title><style>body {margin:0} .sample {background:#dcebe9;color:#182e32}@font-face{font-family:LabFace;src:local("DejaVu Sans");font-display:swap} #a{font-family:LabFace,sans-serif}</style><body><p id="a">Office 012345 — typography</p><p id="b" lang="fa" dir="rtl">سلام دنیا</p></body></html>
CSS Reference