0

I tried to change the width but it only changes the width of the div.
How can I change the width of the image using css?

#photoTable {
    background-image: url("Assets/Images/FrontImages/partyPhoto.jpg");
    height: 628px;
    vertical-align: top;
    width: 704px;
}
EnexoOnoma
  • 8,454
  • 18
  • 94
  • 179

1 Answers1

2

Use the background-size property. You can set it either to a width and height, cover or contain. 100% 100% might be closest to what you want, though.

#photoTable {
    background-image: url("Assets/Images/FrontImages/partyPhoto.jpg");
    background-size: 100% 100%;
    height: 628px;
    vertical-align: top;
    width: 704px;
}

Doesn't work in IE 8 or below.

Brilliand
  • 13,404
  • 6
  • 46
  • 58
  • For getting this to work in IE 8 and below, see the highest-voted (not accepted) answer to this question: http://stackoverflow.com/questions/2991623/make-background-size-work-in-ie – Brilliand May 21 '12 at 21:21