If you want to resize a background image in a div, you can use the background-size
property, which is now widely supported by most browsers.
To make the background image fit inside the div:
background-size: contain;
If you prefer the background image to cover the entire div:
background-size: cover;
Check out this JSFiddle example or use the code snippet below for demonstration:
#imagecontainer {
background: url("http://3.bp.blogspot.com/_EqZzf-l7OCg/TNmdtcyGBZI/AAAAAAAAAD8/KD5Y23c24go/s1600/homer-simpson-1280x1024.jpg") no-repeat;
width: 100px;
height: 200px;
border: 1px solid;
background-size: contain;
}
<div id="imagecontainer"></div>
If you need support for IE 5.5+, there is a filter available, and for older browsers, remember to include vendor prefixes.