If you are going to make this work a cross-browser, you better place the image on the page, and then wrap all your content in a DIV, which will be on top. For instance.
CSS
#background {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
#content {
position: relative;
z-index: 1;
}
If you plan to support IE6, add this snippet:
<!--[if IE 6]>
<style type="text/css">
html {
overflow-y: hidden;
}
body {
overflow-y: auto;
}
#background {
position:absolute;
z-index:-1;
}
#content {
position:static;
}
</style>
<![endif]-->
HTML
<img id="background" src="art/c11.jpg" alt="" />
<div id="content">
Your content
</div>
Code in action.
source
share