CSS to resize / crop / center background image

11 years ago, July 9, 2013
Reading time: 1 mins

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.

-webkit-background-size: cover;
  -moz-background-size: cover;
  -o-background-size: cover;
  background-size: cover;
  background-position: center center;
  background-repeat: no-repeat;
Chain Animation function using deffer / promise in jquery
Delegate / bind toggle event jquery
© 2024 Anil Maharjan