17

Hi all I am trying to strech the background of my side to fit the width. I only found big workarounds in the internet. Is there not one single command for this?

body {
    background-image: url(money.jpg); 
}

Thanks for the answers. Doonot

nimrod
  • 5,595
  • 29
  • 85
  • 149

2 Answers2

38

Use background-size like the one used below,

body {
  background-image: url(money.jpg) no-repeat;
  background-size: 100%;
}  

Some useful links :

Community
  • 1
  • 1
Saurabh Gokhale
  • 53,625
  • 36
  • 139
  • 164
7

If you have a CSS3 browser you can use background-size (read more about background-size):

body {
    background-image: url(money.jpg); 
    background-size: 100%;
}

Unfortunately this won't work in IE 6-8. IE 9, Firefox, Chrome, Safari it will work fine.

Keltex
  • 26,220
  • 11
  • 79
  • 111