---
# Don't modify this file manually. This file is auto generated from source, and you will lose your changes next time the website is built.
# Head to the `biomejs/biome` repository, and modify the source code in there.

title: useGenericFontNames
description: Learn more about useGenericFontNames
---
import { Tabs, TabItem } from '@astrojs/starlight/components';

<Tabs>
<TabItem label="CSS" icon="seti:css">
## Summary
- Rule available since: `v1.8.0`
- Diagnostic Category: [`lint/a11y/useGenericFontNames`](/reference/diagnostics#diagnostic-category)
- This rule is **recommended**, meaning it is enabled by default.
- This rule doesn't have a fix.
- The default severity of this rule is [**error**](/reference/diagnostics#error).
- Sources: 
  - Same as [`font-family-no-missing-generic-family-keyword`](https://github.com/stylelint/stylelint/blob/main/lib/rules/font-family-no-missing-generic-family-keyword/README.md)

## How to configure
```json title="biome.json"
{
	"linter": {
		"rules": {
			"a11y": {
				"useGenericFontNames": "error"
			}
		}
	}
}

```
## Description
Disallow a missing generic family keyword within font families.

The generic font family can be:

- placed anywhere in the font family list
- omitted if a keyword related to property inheritance or a system font is used

This rule checks the font and font-family properties.
The following special situations are ignored:

- Property with a keyword value such as `inherit`, `initial`.
- The last value being a CSS variable.
- `font-family` property in an `@font-face` rule.

## Examples

### Invalid

```css
a { font-family: Arial; }
```

<pre class="language-text"><code class="language-text">code-block.css:1:18 <a href="https://biomejs.dev/linter/rules/use-generic-font-names">lint/a11y/useGenericFontNames</a> ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━<br /><br />  <strong><span style="color: Tomato;">✖</span></strong> <span style="color: Tomato;">Generic font family missing.</span><br />  <br />  <strong><span style="color: Tomato;">&gt;</span></strong> <strong>1 │ </strong>a &#123; font-family: Arial; &#125;<br />   <strong>   │ </strong>                 <strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><br />    <strong>2 │ </strong><br />  <br />  <strong><span style="color: lightgreen;">ℹ</span></strong> <span style="color: lightgreen;">Consider adding a generic font family as a fallback.</span><br />  <br />  <strong><span style="color: lightgreen;">ℹ</span></strong> <span style="color: lightgreen;">For examples and more information, see</span><span style="color: lightgreen;"><a href="https://developer.mozilla.org/en-US/docs/Web/CSS/generic-family"> the MDN Web Docs</a></span><br />  <br />  - serif<br />  - sans-serif<br />  - monospace<br />  - etc.<br />  <br /></code></pre>

```css
a { font: normal 14px/32px -apple-system, BlinkMacSystemFont; }
```

<pre class="language-text"><code class="language-text">code-block.css:1:43 <a href="https://biomejs.dev/linter/rules/use-generic-font-names">lint/a11y/useGenericFontNames</a> ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━<br /><br />  <strong><span style="color: Tomato;">✖</span></strong> <span style="color: Tomato;">Generic font family missing.</span><br />  <br />  <strong><span style="color: Tomato;">&gt;</span></strong> <strong>1 │ </strong>a &#123; font: normal 14px/32px -apple-system, BlinkMacSystemFont; &#125;<br />   <strong>   │ </strong>                                          <strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><strong><span style="color: Tomato;">^</span></strong><br />    <strong>2 │ </strong><br />  <br />  <strong><span style="color: lightgreen;">ℹ</span></strong> <span style="color: lightgreen;">Consider adding a generic font family as a fallback.</span><br />  <br />  <strong><span style="color: lightgreen;">ℹ</span></strong> <span style="color: lightgreen;">For examples and more information, see</span><span style="color: lightgreen;"><a href="https://developer.mozilla.org/en-US/docs/Web/CSS/generic-family"> the MDN Web Docs</a></span><br />  <br />  - serif<br />  - sans-serif<br />  - monospace<br />  - etc.<br />  <br /></code></pre>

### Valid

```css
a { font-family: "Lucida Grande", "Arial", sans-serif; }
```

```css
a { font-family: inherit; }
```

```css
a { font-family: sans-serif; }
```

```css
a { font-family: var(--font); }
```

```css
@font-face { font-family: Gentium; }
```

## Related links

- [Disable a rule](/linter/#disable-a-rule)
- [Configure the code fix](/linter#configure-the-code-fix)
- [Rule options](/linter/#rule-options)
- [Source Code](https://github.com/biomejs/biome/blob/main/crates/biome_css_analyze/src/lint/a11y/use_generic_font_names.rs)
- [Test Cases](https://github.com/biomejs/biome/blob/main/crates/biome_css_analyze/tests/specs/a11y/useGenericFontNames)

</TabItem>
</Tabs>