# noZeroLengthUnit

Rule `biome/noZeroLengthUnit`. Disallow units on zero lengths.

- Source: biome
- Technologies: CSS
- Kind: style
- Needs type information: no
- Autofix: yes, in at least one linter
- Reach: 30.6M weekly downloads of presets that enable it
- Trend: +109.3% last quarter
- Rank: #582 by reach, #217 by growth

## Linters

| Linter | Rule name | Recommended | Autofix | Details | Docs |
| --- | --- | --- | --- | --- | --- |
| Biome | `nursery/noZeroLengthUnit` | yes | unsafe | group nursery, since 2.6.3 | [docs](https://biomejs.dev/linter/rules/no-zero-length-unit/) |

## Code examples

### Incorrect: the rule reports this

```css
a {
  top: 0px;
}
```

```css
a {
  margin: 0.0em auto;
}
```

```css
@media (min-width: 0px) {}
```

### Correct: the rule accepts this

```css
a {
  top: 0;
  left: 2px;
  transition-delay: 0s;
  width: calc(0px + 100%);
  line-height: 0px;
  flex: 1 1 0px;
  font: 16px/0px sans-serif;
}
```

Examples from the Biome documentation.

## Enable it

### Biome: `biome.json`

```json
{
  "linter": {
    "rules": {
      "nursery": {
        "noZeroLengthUnit": "error"
      }
    }
  }
}
```

## Presets that enable it

| Preset | Linter | Package | Rules | Weekly downloads | Trend |
| --- | --- | --- | --- | --- | --- |
| [Biome recommended](https://lintradar.dev/presets/biome-recommended.md) | Biome | `@biomejs/biome` | 491 | 28.5M | +106.8% |
| [Ultracite for Biome](https://lintradar.dev/presets/ultracite-biome.md) | Biome | `ultracite` | 616 | 2.1M | +151.7% |

## Related rules

- [biome/noVueMixin](https://lintradar.dev/rules/biome/noVueMixin.md): Disallow the `mixins` option in Vue components.
- [biome/useBiomeIgnoreFolder](https://lintradar.dev/rules/biome/useBiomeIgnoreFolder.md): Prefer folder exclusions that prevent Biome from scanning the folder.
- [biome/noVoidTypeReturn](https://lintradar.dev/rules/biome/noVoidTypeReturn.md): Disallow returning a value from a function with the return type 'void'
- [biome/useBiomeKindSets](https://lintradar.dev/rules/biome/useBiomeKindSets.md): Require kind sets instead of comparing kind names one by one in Biome JS plugins.
- [biome/noUselessStringRaw](https://lintradar.dev/rules/biome/noUselessStringRaw.md): Disallow unnecessary `String.raw` function in template string literals without any escape sequence.
- [biome/useBiomeTopLevelTypes](https://lintradar.dev/rules/biome/useBiomeTopLevelTypes.md): Require kind sets in Biome JS plugins to be created at the top level of the module.

---

Web page: https://lintradar.dev/rules/biome/noZeroLengthUnit. Data from npm and the linters' documentation, collected Dec 4, 2026. Site guide for agents: https://lintradar.dev/llms.txt
