I think that "works fine in Firefox" is only in Quirks mode . In Standard Mode rendering , this may not work in Firefox.
the percentage depends on the "containing block", and not on viewing.
CSS specification says
The percentage is calculated using the relative height of the generated block containing the block. If the height of the containing block is not explicitly specified (that is, it depends on the height of the content) and this element is not completely positioned, the value evaluates to "auto".
So
#container { height: auto; } #container #mainContentsWrapper { height: n%; } #container #sidebarWrapper { height: n%; }
means
#container { height: auto; } #container #mainContentsWrapper { height: auto; } #container #sidebarWrapper { height: auto; }
To stretch to 100% of the height of the viewport, you need to specify the height of the containing block (in this case #container). In addition, you also need to specify the height for the body and html, because the original containing block is "UA dependent".
All you need is ...
html, body { height:100%; } #container { height:100%; }
timeblue Oct 06 '08 at 22:26 2008-10-06 22:26
source share