Check how an ordered CSS font stack handles fallback
Admin ·
A font stack lists the families a browser can try for your text. Put your preferred face first, follow it with suitable named families, and include a generic family so the platform can choose a final fallback.
Put DM Sans ahead of the sans-serif fallbacks
Keep DM Sans Variable as Primary family and choose Cross-platform sans. The fallback names become Arial, Helvetica and Liberation Sans in that order. The CSS adds sans-serif at the end as a generic keyword.
Add Arial again on a new line to check how repeated names behave. The rule keeps the first occurrence. Move Helvetica to the top of the fallback list to give it priority when the primary family is unavailable.
.sample-text {
font-family: "DM Sans Variable", "Arial", "Helvetica", "Liberation Sans", sans-serif;
}Compare the preview with the primary family skipped
Enter text that looks like your project content. Select Preview with the primary family skipped to see the browser try just the fallbacks. The CSS rule keeps the primary name in place.
The available families can vary by device. A single line can also draw different characters from different families when a face lacks a glyph. Check the writing systems and symbols that the project uses.
W3C CSS Fonts Level 4, font-family propertyW3C CSS Fonts Level 4, font matching
Verify the family order in the stylesheet
Download font-fallback-stack.css and open it in an editor. Apply the sample-text class to your target element. Load any custom family through your project’s font settings.
For code, try Monospace and clear the primary family. The rule now starts with Consolas, Menlo and Liberation Mono and ends with monospace. Compare the sample on the platforms your readers use.
Common questions
Why does the generic family appear without quotation marks?
An unquoted generic keyword refers to a browser-defined family category. A quoted name refers to an explicit font family, even when its spelling resembles a generic keyword.
Can a fallback list start with no primary family?
Yes. Leave the primary field blank and list the preferred explicit families in order, or choose only a generic family.