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