LoginSignup
3
0

More than 5 years have passed since last update.

CSS: キーフレーム内で!important付けた宣言は無視される

Posted at

MDNの@keyframesの解説に「キーフレーム内で!importantが付けられた宣言は無視される」とあるものの、どういう意味なのか分かりませんでした。
「詳細度(優先順位)を上書きする効果がなくなる」という意味なのかと思ったら、「そのスタイル指定がまったく働かなくなる」という意味でした。

@keyframes important {
  50% {
    width: 300px !important; /* スタイル指定が無視される */
    background: lightgreen; /* こちらは問題なし */
  }
}

See the Pen CSS: Declarations in a keyframe qualified with !important are ignored by Yuusaku Miyazaki (@sutara79) on CodePen.

3
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
0