问题如上`

解决方案 »

  1.   

    <img src="your img path" style="width:100%;height:100%" alt="#" />
    用相对大小就是了.
      

  2.   

    有个不太,,,合适的办法,
    <img src="#" onload="return javascript:resize(this)"<script>
    functioin resize()
    {
    if this.width>800
    this.width=500;
    }
    </script>
      

  3.   

    HTML图片缩放代码,按设定的大小图片自动缩放。首先给图片加个<div></div>标签对,img中不能定义高度或宽度,如下:
    <div class="product_img_div"><img src="images/test.jpg" class="product_img" /></div>在CSS中写入代码:.product_img_div {width:210px;height:190px;overflow:hidden}作用是控制图片载入时,溢出部分隐藏,这样就不会把界面撑得太难看。测试后,图片大小完美缩放,也解决了在载入时会把界面撑得很难看的问题。再写JS代码,代码如下:ReSizeImg("product_img",200,180);
    function ReSizeImg(cName,w,h){
        var reImgs = document.getElementsByTagName("img");
        for (j=0;j<reImgs.length;j++){
            if (reImgs[j].className==cName && (reImgs[j].height>h || reImgs[j].width>w)) {
                if (reImgs[j].height==reImgs[j].width) {
                    reImgs[j].height=h;reImgs[j].width=w;
                } else if (reImgs[j].height>reImgs[j].width) {
                    reImgs[j].height=h;
                } else if (reImgs[j].height<reImgs[j].width){
                    reImgs[j].width=w;
                }
            }
        }
    }