Skip to content

Instantly share code, notes, and snippets.

@benhodgson
Created February 4, 2011 11:37
Show Gist options
  • Save benhodgson/811017 to your computer and use it in GitHub Desktop.
Save benhodgson/811017 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<style>
html {
height: 100%;
}
body{
height: 100%;
}
.myDiv {
height: 100%;
background-color: red;
}
</style>
<body>
<div class="myDiv"></div>
</body>
@edds
Copy link

edds commented Feb 4, 2011

You totally want to add a margin: 0; to the body element. That would make this an awesome full page red!

Ohh and without a title tag this page is invalid... you know validation Ben ;-)

@benhodgson
Copy link
Author

I laugh in the face of validation.

@edds
Copy link

edds commented Feb 4, 2011

well if we are going for omitting as much as possible this might work better:

<!doctype html>
<style>
  html,body,div { height:100%; }
  div { background:red; }
</style>
<div></div>

Yer I can optimise. Check me out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment