Perhaps this will be helpful. Because "Viewport Units" currently don't have great browser support, you may want to use height 100% instead.
Viewport Unit Browser Support Table: http://caniuse.com/#search=vh
If you want the div to cover areas that go below the viewport into the scrollable areas, try the code below:
html{
margin:0;
padding:0;
border:none;
height:100%;
}
body {
margin:0;
padding:0;
border:none;
height:100%;
}
#wrapper-div {
min-height:100%;
}
The trick is setting the height to 100% on the html and body tags, and setting min-height 100% on the wrapper div. The div will expand 100% horizontally by default. Min and max width and height have great browser support, except IE6. (Note: If you still neet to support IE6, there is an easy hack that'll make it work. Add this to your wrapper-div, but your css won't validate{*display:inline; *zoom:1;}
)
Browser Support for Min and Max Height and Width http://caniuse.com/minmaxwh
Here's a JSFiddle that has both the 100% and Viewport Units to play with:http://jsfiddle.net/TalkingRock/ZHC5h/
If you want to use Viewport Units, try this code. It sets the width as vw, not vh:
body {
margin:0;
height:100vh;
width:100vw;
}
#wrapper-div {
height:100vh;
width:100vw;
background-color:#cccccc;
color:#000000;
}
Here's a quote from this article:http://dev.opera.com/articles/view/css-viewport-units/
- 1vw: 1% of viewport width
- 1vh: 1% of viewport height
- 1vmin: 1vw or 1vh, whatever is smallest
- 1vmax: 1vw or 1vh, whatever is largest