Scale All Images To Fit Container Proportionally
I am building a customization script where a user can upload an image and drag it around a template image to get a desired result. The problem is the template image is over 1000px
Solution 1:
I'm not quite sure if that is what you are asking for … anyway:
The CSS3 property background-size: 100%
lets you specify that the background image of should fill out the container's size and stretch proportionally. Together with background-repeat: no-repeat
it might be what you are looking for:
#uploaded {
height: 500px;
width: 500px;
background-image: url(...);
background-size: 100%;
background-repeat: no-repeat;
}
Demo: http://jsfiddle.net/pu76s/3/
Post a Comment for "Scale All Images To Fit Container Proportionally"