If I have the following markup
<html>
<body>
<div id="wrapper">
<div id="container">
<p>Lots of pragraphs here</p>
</div>
</div>
</body>
</html>
with the following styles
html, body, #wrapper
{
width: 100%;
height: 100%;
}
#container
{
width: 960px;
margin: 0 auto;
}
why does not my html, body and wrapper elements extend to 100% height of the browser/view port in FF13. The html, body and wrapper stop vertically about some distance from the bottom when looking in Firebug. The container div extends to the full height as it’s height is determined by the content.
(1263px X 558px for html, body, wrapper) and (960px X 880px for container)
Looking at default 100% the above happens as the first image below shows. But when I zoom to the last poosible zoom in, the above does not happen as the second image below shows and the html, body, wrapper extends to the full height.
(4267px X 1860px for html, body, wrapper) – (960px X 1000px for container)


Your
htmlactually exactly extends to 100% height of your viewport cause viewport here is the browser window, not the inner content.Consider this (jsfiddle):
div1here has the height of 300px and is scrolled. When you scroll content you simply move inner div but height remains untouched that is300px. Exactly the same happens when you setheight:100%to html. Your browser’s height remains the same.When you zoomed out your viewport then you have not scroll, so inner content’s height is less than the height of viewport.
Shortly,
html {height:100%}relates to parent’s height not to the height of the inner contentUPDATE:
you can specify 3 types of values to the block-element’s height:
length – set fixed height (i.g. ‘200px’, ’50em’). That’s all, I can say nothing more about that.
percentage – from W3C spec:
What is happening when browser shows your page:
height: 100%for<html>. That means that the resulting height is calculated with respect to the height of the generated box’s (html-element in that case) containing block (initial containing block, i.e.browser windowin that case). Let’s say1024px.height: 100%for<body>. It will setbody‘s height to the already calculated height of thehtml, that is1024px.height:autoto the#wrapperand then the#containerand the<p>. I don’t know how it does that exactly but can suppose that it postpones the height setting (and respectively all other styles which depend on that i.e. backgrounds, borders etc.) and proceeds to the inner content.default styles, like font-family, font-size and the height of the text.<p>-element so the<p>will stretch down to contain all content (the text in that case). The same then happens to the#containerand the#wrapper.If it happens that the height of the
#wrapperis greater than the body’s one (1024 pxas it were agreed) than theoverflowshould be applied to thebody. That isvisiblewhich is the default. Thenoverflow: visibleis applied to thehtml. Then browser shows scroll for the entirewindow. Honestly, I don’t know whether this is specified by the W3C spec, but can suppose it is.So when you scroll the window your
htmlandbodyare moved as are all the other elements. This is the same behavior as is with any other elements (like in jsfiddle I posted above):Note that the background is set on the
bodyelement, but it extends to the entire canvas i.e. far beyond of thebodyelement itself. This is towards your concern of the possible necessity of setting bg-property on the body. This is 100% compliant with the W3C spec which states (cutted):When you zoom out your page then browser recalculates all dimensions. Let’s say, with each

Ctrl+-click page shrinks, for example, for 20 %. Then all your text is reduced, cause its height depends on the font-size, which is affected by theCtrl+-click, correspondingly<p>,#containerand#wrapperall are reduced cause their height depends ontext‘s height. Butbodyandhtmlboth have height which depends on thewindow‘s height which is not affected by theCtrl+-click. That is why you finally get this:There is no difference here between width and height behavior in that case. You don’t see the same issue with horizontal dimension simply because you’ve set

width: 960px;for the#containerwhich turned out to be less than your browser window’s width, so no overflowing occurs. If the width of the#containerwere exceeding body’s width you would see this:This all is a normal and expected behavior and there is nothing to solve here.