Be sure you set the height of html, body
.
By default, the html
and body
elements do not take up the entire height of the window. You have to explicitly set the height of html, body
to force them to span the entire height of the window.
html, body {
height:100%;
}
By forcing the html, body
to take up the entire height of the window and then placing the div { width:100%; height:100%; }
as a child of the body
element you can ensure that the div
will stretch to 100% of the window's width and height.
Here's an example: http://jsfiddle.net/ewF8M/