Forum Moderators: not2easy
<html>
<head>
<style>
body {margin:0;
padding:0;
height:100%;
background-color:#990033;
}
</style>
</head><body>
<div style="position: absolute; top:0;left:0;height:100%; width:100%;">
<div style="position:relative;margin:0 auto; background-color:#ffffff; height:100%;text-align:left;width:780px;">
Sample<br /><br /><br /><br /><br /><br /><br />
<br /><br /><br />
Sample<br /><br /><br /><br /><br /><br /><br /><br />
<br /><br />
Sample<br /><br /><br /><br /><br /><br /><br /><br />
<br /><br />Sample<br /><br /><br /><br /><br /><br /><br />
<br /><br /><br />Sample<br /><br /><br /><br /><br />
<br /><br /><br /><br /><br /></div>
</div>
</body>
</html>
is giving different results in ie6 and firefox. What is wrong?
How can someone make the behaviour of ie6 to be enforced in firefox and other browsers, too?
Thank you,
G.
Don't know if that is how you intended it to look though.
Based on your idea, I found it...
I was looking for:
<div style="position: relative; height:100%; width:100%;">
<div style="position: absolute; top:0;left:0;height:100%; width:100%;">
<div style="position:relative; margin:0 auto; background-color:#ffffff; text-align:left;width:780px;">
to have the same behaviour...
G.
is giving different results in ie6 and firefox. What is wrong?
There's nothing wrong - Firefox is displaying the height property the way it should.
That is to say, your
body is displaying at 100% of its parent element - html (which, incidentally, has a height of its contents - so the exact height of body is now the exact height of html, and 100% of html is not 100% of viewport.) AWildman showed you how to fix this, because he specified
html to also be 100%, which (as it has no parent element) assumes the height to be 100% of the viewport, and as body is 100% of the parent element html, body also becomes 100% of the viewport. Why does IE render this differently? Because it is incorrectly rendering the proportional height property value.
I hope this explains more in addition to AWildman's reply, as to why the solution works :)
[edited by: Setek at 5:05 am (utc) on Oct. 3, 2006]