Skip to content

noImportantInKeyframe

诊断类别:lint/suspicious/noImportantInKeyframe

¥Diagnostic Category: lint/suspicious/noImportantInKeyframe

自从:v1.8.0

¥Since: v1.8.0

来源:

¥Sources:

禁止在关键帧声明中允许无效的 !important

¥Disallow invalid !important within keyframe declarations

在某些浏览器中,在关键帧声明中使用 !important 会被完全忽略。

¥Using !important within keyframes declarations is completely ignored in some browsers.

¥Examples

¥Invalid

@keyframes foo {
from {
opacity: 0;
}
to {
opacity: 1 !important;
}
}
code-block.css:6:18 lint/suspicious/noImportantInKeyframe ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Using !important within keyframes declaration is completely ignored in some browsers.

4 │ }
5 │ to {
> 6 │ opacity: 1 !important;
^^^^^^^^^^
7 │ }
8 │ }

Consider removing useless !important declaration.

¥Valid

@keyframes foo {
from {
opacity: 0;
}
to {
opacity: 1;
}
}

¥Related links