CSS Background always fill all available space

I’ve been trying to do this for absolutely forever – have a background image that always covers the screen, regardless of the size or orientation of the screen, and with no visible space. I finally found out how to do it using nothing but CSS applied to the body, so here it is!


body
{
background-color:#444444;
background: url("/public/img/imageName.png") no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}

Leave a Reply