CSS Backgrounds

liunx

Guest
Is there any way, in CSS or otherwise, to have your background automatically size it self to the browser window? I would of course make its attachment fixed, then the background would always be completely visible, no matter what resolution is viewing it.No, unfortunately CSS2 does not provide a way to specify or modify the dimensions of background images.No not with CSS, but I just got a reply on something like this In Javascript:

<script type="text/javascript">

document.onload=pickIt()
function pickIt()
{
var w=screen.width
var h=screen.height
if(w==1024&&h==768)
{
document.getElementsByTagName('body')[0].style.backgroundImage="url('URL OF SMALLER BACKGROUND IMAGE')";
}
else if(w==1152&&h==864)
{
document.getElementsByTagName('body')[0].style.backgroundImage="url('URL OF LARGE BACKGROUND IMAGE')";
}
}
</script>


Just fill in the areas with the code.

Note: You Will Need one image for each

Note: You may need to restart your browser when you change resolutions while on the internet.
 
Back
Top