UNPKG

1.44 kBMarkdownView Raw
1# font-family-no-missing-generic-family-keyword
2
3Disallow missing generic families in lists of font family names.
4
5<!-- prettier-ignore -->
6```css
7a { font-family: Arial, sans-serif; }
8/** ↑
9 * An example of generic family name */
10```
11
12The generic font family can be:
13
14- placed anywhere in the font family list
15- omitted if a keyword related to property inheritance or a system font is used
16
17This rule checks the `font` and `font-family` properties.
18
19## Options
20
21### `true`
22
23The following patterns are considered violations:
24
25<!-- prettier-ignore -->
26```css
27a { font-family: Helvetica, Arial, Verdana, Tahoma; }
28```
29
30<!-- prettier-ignore -->
31```css
32a { font: 1em/1.3 Times; }
33```
34
35The following patterns are _not_ considered violations:
36
37<!-- prettier-ignore -->
38```css
39a { font-family: Helvetica, Arial, Verdana, Tahoma, sans-serif; }
40```
41
42<!-- prettier-ignore -->
43```css
44a { font: 1em/1.3 Times, serif, Apple Color Emoji; }
45```
46
47<!-- prettier-ignore -->
48```css
49a { font: inherit; }
50```
51
52<!-- prettier-ignore -->
53```css
54a { font: caption; }
55```
56
57## Optional secondary options
58
59### `ignoreFontFamilies: ["/regex/", /regex/, "string"]`
60
61Given:
62
63```
64["custom-font"]
65```
66
67The following pattern is _not_ considered a violation:
68
69<!-- prettier-ignore -->
70```css
71a { font-family: custom-font; }
72```
73
74The following pattern is considered a violation:
75
76<!-- prettier-ignore -->
77```css
78a { font-family: invalid-custom-font; }
79```