This article provides three kinds of pictures to shrink the code proportionally, one is to use the CSS tutorial to force the picture scaling down, after two is to use the Web page effects on the picture proportionally to shrink the code
<style> <!--CSS to force a proportional reduction of the picture, in many cases, without this method, will increase the IE load. --> . thumbimage { max-width:50px; max-height:50px; } * HTML. Thumbimage { Width:expression (This.width > && this.width > This.height 50:true); Height:expresion (This.height > 50:true); }
<script type= "text/web Effects" > function Setimgsize (img,width,height) { var maxwidth=width;//set Picture width limit var maxheight=height;//set Picture height limit var heightwidth=img.offsetheight/img.offsetwidth;//set aspect ratio var widthheight=img.offsetwidth/img.offsetheight;//set ratio of width to height if (img.offsetwidth>maxwidth) { Img.width=maxwidth; Img.height=maxwidth*heightwidth; } if (img.offsetheight>maxheight) { Img.height=maxheight; Img.width=maxheight*widthheight; } }
</script>
Uses: <img src= "/www.jzread.com/logo-yy.gif" border=0 onload= "setimgsize (this,132,160);" <script language= "Web Effects" > <!-- var flag=false; Function DrawImage (IMGD) { var image=new image (); Image.src=imgd.src; if (image.width>0 && image.height>0) { Flag=true; if (image.width/image.height>= 180/110) { if (image.width>180) { imgd.width=180; imgd.height= (image.height*110)/image.width; }else{ imgd.width=image.width imgd.height=image.height; } /*imgd.alt= "bigpic" */ } else{ if (image.height>110) { imgd.height=110 ; imgd.width= (image.width*110)/image.height; }else{ imgd.width=image.width imgd.height=image.height; } /*imgd.alt= "Bigpic"/ } } } //--> </script>
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.