note から WordPress に出戻りました!😭

[ CSS ] IE で垂直マージンが相殺できないバグ

だるかぶ

サンダルでスーパーカブ乗りの『だるかぶ』です!
ご訪問ありがとうございます。ゆっくりしていってね。(本ページは広告を含みます。)

Internet Explorer は width 指定があると、垂直マージンが相殺できないみたい。

https://codepen.io/darucub/pen/wBGaVPQ

▲ サンプル

CSS のソース

#main {
  width: 100%;
}
#menu {
  margin-top: 1em;
}
#main p {
  margin-bottom: 1em;
}

HTML のソース

<div>
  <p>段落 1</p>
</div>
<div>
  <p>段落 2</p>
</div>

Internet Explorer 7.0 での表示結果

Internet Explorer 7.0 での表示結果

Internet Explorer 7.0 での表示結果

Firefox 2.0 での表示結果

Firefox 2.0 での表示結果

Firefox 2.0 での表示結果

問題となるブラウザ

  • Internet Explorer 7.0

  • Internet Explorer 6.0

  • Internet Explorer 5.5

ハマったよ。orz バグの回避方法を考える。

現場からは以上です。それでは、またッ!!!