Scale and Centre Image

This simple piece of code will attempt to scale and center an image to 'best fit' it into a DIV of your choosing. Note that it attempts to fill the DIV completely, so you may not get the result you want

However it can be extremely useful if you have a lot of images that are of a similar size and orientation. Try copying and pasting any landscape image URL into the box below, or try a few of these:-

https://upload.wikimedia.org/wikipedia/commons/e/e4/Stourhead_garden.jpg
http://www.landscapes.org/london/wp-content/uploads/sites/8/2015/09/roadmap-to-landscapes-finance.jpg
http://tremendouswallpapers.com/wp-content/uploads/2014/12/landscapes-nature_00428401.jpg

The image as it is

The image scaled and centered to fit a 320 x 225 px DIV

If you want a basic version of this page, you can see it HERE, and download the code HERE
© Shotton IT 2016. All Rights Reserved. | More Information

e : info@shottonit.co.uk     t : 01922 513 008