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

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

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

CSS のソース

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

HTML のソース

<div id="main">
  <p>段落 1</p>
</div>
<div id="menu">
  <p>段落 2</p>
</div>

Internet Explorer 7.0 での表示結果

Internet Explorer 7.0 での表示結果

Firefox 2.0 での表示結果

Firefox 2.0 での表示結果

問題となるブラウザ

  • Internet Explorer 7.0
  • Internet Explorer 6.0
  • Internet Explorer 5.5

ハマったよ。orz

バグの回避方法を考える。

関連する記事

Comments: 3

(ai) 07-09-05 (水) 18:13

中の要素に問題がなければpタグに
display:inline
を指定するとかで回避できるかな

Bowz 07-09-05 (水) 21:39

コメントありがとうございます。
ちょっと検証してみます。

Bowz 07-09-06 (木) 20:11

#main p に display: inline; を追加すると正常な表示になりました。ありがとうございます。

Comment Form
Remember personal info

Trackback+Pingback: 0

TrackBack URL for this entry
http://bowz.info/964/trackback
Listed below are links to weblogs that reference
[ CSS ] IE で垂直マージンが相殺できないバグ from Bowz::Notebook

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

タグクラウド

Return to page top