font-family-no-missing-generic-family-keyword
CSS / SCSS / LessCSS / SCSS / LessCSS / SCSS / Lesscorrectnessno fixdefault: offcss/stylelint-recommended
What it does
Section titled “What it does”Reports a font-family (or font) list that has no generic family (serif, sans-serif, monospace, …). @font-face is not checked.
Why it matters
Section titled “Why it matters”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.
Example
Section titled “Example”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; }Configuration
Section titled “Configuration”css: lint: rules: font-family-no-missing-generic-family-keyword: warn # off (default), warn, errorless: lint: rules: font-family-no-missing-generic-family-keyword: warn # off (default), warn, errorscss: lint: rules: font-family-no-missing-generic-family-keyword: warn # off (default), warn, errorEnabled 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.
Upstream equivalents
Section titled “Upstream equivalents”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 |