tags:

views:

17

answers:

1

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:#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>
+1  A: 

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.

Liam Bailey
I have pasted all of the HTML and CSS code. I'm currently testing on a local pc, therefore no link to provide. I basically need a container div which has 10px margins all around. The container div should resize automatically, but the margins must be constant 10px.