If you are using a full screen background image, there is a convensional way too, using javascript which is too complex.

The CSS method described in this post requires no javascript and is compatible on most of the modern browsers. That includes IE 9 and higher.

 


#fullscreen-bg{
-webkit-background-size: cover;
  -moz-background-size: cover;
  -o-background-size: cover;
  background-size: cover;
  background-position: center center;
  background-repeat: no-repeat;
}