Skip to content

Instantly share code, notes, and snippets.

@nunomazer
Created May 24, 2011 15:48
Show Gist options
  • Save nunomazer/988957 to your computer and use it in GitHub Desktop.
Save nunomazer/988957 to your computer and use it in GitHub Desktop.
Background image in HTML using pure CSS (not CSS3)
#background {
width: 100%;
height: 100%;
position: fixed;
left: 0px;
top: 0px;
z-index: -1;
}
.stretch {
width:100%;
height:auto;
min-height:100%;
}
<div id="background">
<img src="img.jpg" class="stretch" alt="" />
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment