Skip to main content

keyframe-declaration-no-important

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

¥Disallow invalid !important within keyframe declarations.

@keyframes foo {
from { opacity: 0 }
to { opacity: 1 !important }
} /* ↑ */
/** ↑

* This !important */

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

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

选项

¥Options

true

以下模式被认为是一个问题:

¥The following pattern is considered a problem:

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

以下模式不被视为问题:

¥The following patterns are not considered problems:

@keyframes foo {
from {
opacity: 0;
}
to {
opacity: 1;
}
}
a { color: pink !important; }