LoginSignup
1
2

More than 3 years have passed since last update.

IEでCSSプロパティのinitialとunsetを指定するとスタイルが崩れてしまう時の解決法

Posted at

CSSのプロパティの initialunset はIE11に対応していないためスタイルが崩れてしまいます。
詳しくはこちら(initial unset)を参照してください。
この記事ではこの問題に対処するために代表的なプロパティごとの解決法を書きます。

解決法

margin/padding/width/heightの場合

auto の記載を追加することでIEに対応できます。

sample.css
.block {
  margin: initial;
  /* IE対応のために追加する */
  margin: auto;
}

line-height/font-weight/font-styleの場合

normal の記載を追加することでIEに対応できます。

sample.css
.block {
  line-height: initial;
  /* IE対応のために追加する */
  line-height: normal;
}
1
2
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
1
2