开发者

CSS horizontal centering, and min-height not working in IE

<div id="wrapper">
    <div id="content" style="background-color: white;">
        ...   
    </div>    
</div>

#content{
  float: left;
  width: 540px;
  padding: 30px 30px 0px 30px;
  background-color:#19252f;
  开发者_如何学Gotext-align: left;
  min-height: 500px;
}
#wrapper {
   margin: 0 auto;
   width: 800px;
}

CSS horizontal centering, and min-height not working in IE

Firefox look

CSS horizontal centering, and min-height not working in IE

Internet Explorer 8 look


  1. margin:auto horizontal centering is not supported in IE6. Instead you can either use absolute positioning to center or you can do

    body{ text-align:center; }

  2. For IE min-height you need to add the hacked property _height: 300px in addition to min-height: 300px; All browsers but IE will ignore the hacked property, and since IE effectively treats height as min-height, you’ll get the effect that you want in all browsers.

  3. background-color works in IE without any problems.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜