7/9/2013
Reading time: 1 mins

CSS to resize / crop / center background image

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;
}
Previous
Chain Animation function using deffer / promise in jquery
Next
Delegate / bind toggle event jquery
© 2024 Anil Maharjan