Skip to content

font-family-no-missing-generic-family-keyword

Reports a font-family (or font) list that has no generic family (serif, sans-serif, monospace, …). @font-face is not checked.

When none of the named fonts is installed, the browser uses its default font, which can be a serif face on a page designed for sans-serif. A generic family at the end tells it which kind of face to fall back on.

To fix, end the list with the generic family that fits the first font.

Reported
a {
font-family: Arial, Helvetica;
font-family: "Arial", serif;
font-family: Arial, inherit;
...
font: 12px/1.5 Arial;
font: 12px Arial, sans-serif;
}
@font-face { font-family: Foo; }
css:
lint:
rules:
font-family-no-missing-generic-family-keyword: warn # off (default), warn, error
less:
lint:
rules:
font-family-no-missing-generic-family-keyword: warn # off (default), warn, error
scss:
lint:
rules:
font-family-no-missing-generic-family-keyword: warn # off (default), warn, error

Enabled by the presets: css/stylelint-recommended.

Suppress one line with sudsy-disable-next-line font-family-no-missing-generic-family-keyword in a comment of the file’s language.

The same check in other tools; Sudsy reports what each upstream rule reports.

Tool Rule Match
stylelint font-family-no-missing-generic-family-keyword full