FiFont
← All guides

Web design

Self-host a font with CSS

Use a local font file with CSS while retaining its original license.

1. Choose the needed style

Open a family, inspect Styles and download the exact file or the family ZIP. Avoid requesting unused weights on the first page.

2. Keep the license beside assets

Extract OFL.txt and preserve relevant copyright notices. If converting or modifying a font, review reserved font names and redistribution conditions.

3. Set up the font-face rule

Use the Use on web tab to copy the selected style's CSS. Place the file at the referenced URL, and add a fallback such as sans-serif or serif to your actual selector.

4. Inspect browser loading

In developer tools, reload and check the Network and Fonts panels. Confirm the requested asset, MIME type, CORS if cross-origin, font weight and fallback behavior.

A small reproducible web test

Download an original face, place it in a fonts folder with its license, and copy the Use on web rule. Change only the URL to match that file. Apply the declared family to one paragraph and put sans-serif after it as a fallback. Reload with developer tools open; the font request should return a font file rather than HTML, and the rendered-font panel should show the intended face. Repeat at the actual heading and body weights.

Common pitfall

A copied @font-face rule does not automatically style your page. Use the family on an element, avoid preloading unused faces and keep a fallback. For a cross-origin asset, verify the server's CORS and font MIME response.

Open CSS example →

Continue learning

Typography reference with visual examples →