Le 12/10/08 3:55 AM, David Mark a écrit :
That is an approximation of a fixed and centered background image
Absolutely.
(with compatibility issues.)
Yes, that was precised.
The OP requested a "foreground" image.
and ?
doesn't it appear in rear ?
leaving the background for other so beautiful wall-paints
Is it never possible to answer with a different light than was waited ?
(asked, expected)
The background image centered in viewport ... (works too in my IE6)
<style type="text/css">
body { background: url(banner.gif) no-repeat fixed center center #eee; }
</style>
Ho! ? *FORE*ground ?
^^^^^^
What a strange idea !
The previous style is OK for me if the z-index is deleted.
(probably better if the image is just before </body> )
I suppose that works with IE 7
Proposition (for IE6 and missing : resize) waiting observations:
<script type="text/javascript">
var t;
function fix() {
if(!t) t = document.all.banner.offsetTop;
document.all.banner.style.top = t + document.body.scrollTop +'px';
// facultative verification :
window.status = t +' - '+document.all.banner.offsetTop+' - '+
document.body.scrollTop;
}
</script>
<style type="text/css">
#banner {
position: fixed;
top: 50%; left: 50%;
width: 300px; height: 100px;
margin-left: -150px; margin-top: -50px;
_position: absolute; /* hack IE */
_margin-top: -25px; /* correction IE (status bar ?) */
}
</style>
</head>
<body onload="if(document.all) fix();"
onscroll="if(document.all) fix();">
<img id="banner" src="banner.gif" alt="" />