开发者

Firefox, will not auto resize container height: 100%, bottom margin is lost!

I have a container and 4 div’s inside it. My container is stretched to fill the entire window. In IE, if you re-size the window all the content re-sizes correctly, with all 4 margins around the container visible. I’m trying to get the same behavior in FF, yet I can’t seem to find the right CSS recipe.

Note, if you past the HTML and CSS code and examine the behavior in the IE, I’m trying to achieve the same behavior in FF.

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <title>IE AutoResize</title>


<style type="text/css" media="screen">

html {
     height:100%;
     width:100%;
     overflow: hidden;
     margin-bottom:40px;
}

body {
     height:100%;
     margin-top: 10px;
     margin-left: 10px;
     margin-right: 10px;
}

#container{
     background-color:#808080;
     height: 100%;
     Valignment-adjust: central;
     padding: 10px 10px 10px 10px;
}

#top {
     background-color:#00FF80;
     height: 10%;
}

#left {
     background-color:#FF8000;
     float:left;
     width: 20%;
     height:80%;
}

#right {
     background-color:#3944C6;
     width: 80%;
     height:80%;
     float:right;
}

#bottom {
     clear:both;
     background-color:开发者_如何学Python#FF0000;
     height: 10%;
}
</style>



  </head>
  <body>

     <div id="container">
           <div id="top">top</div>
           <div id="left">left</div>
           <div id="right">right</div>
           <div id="bottom">bottom</div>
     </div>

  </body>
</html>


I am afraid this is another case of IE getting it wrong, and FF getting it right. You cannot have 100% height and then have an additional margins or padding top or bottom, you will need to find another way. If you could post your html or a link we may be able to guide further.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜