I was creating a UI from a PSD file and after I extracted the image background I realized that it was only 970px wide.  So I went searching for a good way to stretch it out in the background and I ran across this gem.

The HTML:

<div id="dvbackground">
 <img src="YOURIMAGESOURCE" class="stretch" alt="" />
</div>

The CSS:

#dvbackground
{
 width:100%;
 height:100%;
 position: fixed;
 left:0px;
 top:0px;
 z-index: -1;
}

.stretch
{
 width:100%;
 height:100%;
}
Advertisements