跳转到内容

noUnknownUnit

Diagnostic Category: lint/correctness/noUnknownUnit

Since: v1.8.0

Sources:

Disallow unknown CSS units.

For details on known CSS units, see the MDN web docs.

a {
width: 10pixels;
}
code-block.css:2:12 lint/correctness/noUnknownUnit ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Unexpected unknown unit: pixels

1 │ a {
> 2 │ width: 10pixels;
^^^^^^
3 │ }
4 │

See MDN web docs for more details.

Use a known unit instead, such as:

- px
- em
- rem
- etc.

a {
width: calc(10px + 10pixels);
}
code-block.css:2:24 lint/correctness/noUnknownUnit ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Unexpected unknown unit: pixels

1 │ a {
> 2 │ width: calc(10px + 10pixels);
^^^^^^
3 │ }
4 │

See MDN web docs for more details.

Use a known unit instead, such as:

- px
- em
- rem
- etc.

a {
width: 10px;
}
a {
width: 10Px;
}
a {
width: 10pX;
}
a {
width: calc(10px + 10px);
}