Skip to content

Instantly share code, notes, and snippets.

@mrinalwadhwa
Created June 15, 2012 20:32
Show Gist options
  • Save mrinalwadhwa/2938574 to your computer and use it in GitHub Desktop.
Save mrinalwadhwa/2938574 to your computer and use it in GitHub Desktop.
CSS to make a div take the entire page, width & height 100%
<!DOCTYPE html>
<!--[if lt IE 7]><html class="lt-ie9 lt-ie8 lt-ie7" lang="en"><![endif]-->
<!--[if IE 7]><html class="lt-ie9 lt-ie8" lang="en"><![endif]-->
<!--[if IE 8]><html class="lt-ie9" lang="en"><![endif]-->
<!--[if gt IE 8]><!--><html lang="en"><!--<![endif]-->
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Box</title>
<style>
html, body {
margin: 0;
padding: 0;
height: 100%;
}
.box {
min-height: 100%;
}
.lt-ie7 .box {
height: 100%;
}
</style>
</head>
<body>
<div id="container" class='box' style="background-color: green"></div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment