Web design or programming at how the most convenient way to deal with the wide picture high in order to achieve the best effect, this question a lot of trust production staff pages are encountered, the most troublesome of the most time is spent mapping Photoshop and other software to deal with faces, the method 12, if not handled better, the more trouble it; fastest practice are fixed directly to the picture of a wide high disadvantage to do so is the impact of page appearance, and Most of the practice is to use JS to control the picture display size at a certain range will not imbalance to ensure the picture is not deformed, I believe this method is most suitable.

The following script in IE, FIREFOX, OPERA, NETSCAPE test is applicable to all (by @ cricket cricket):

Program code

function SetSize (obj)
(

var width = 80; height = 60;
myImage = new Image ();
myImage.src = obj.src;
if (myImage.width> 0 & & myImage.height> 0)
(
var rate = 1;
if (myImage.width> width | | myImage.height> height)
(
if (width / myImage.width <height / myImage.height)
(
rate = width / myImage.width;
)
else
(
rate = height / myImage.height;
)
)
if (window.navigator.appName == "Microsoft Internet Explorer")
(
obj.style.zoom = rate;
)
else
(
obj.width = myImage.width * rate;
obj.height = myImage.height * rate;
)
)
)

Usage:

Program code

<img src="img/offer/41936519.jpg" border="0" onload="SetSize(this)"/>