css 圖片自動縮放

來源:互聯網
上載者:User
 代碼如下 複製代碼

<!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=gb2312" />
<title>css 圖片自動縮放</title>
<style type="text/css">
.imgsize {
width:expression(this.width>78?"78px":this.width+"px");
height:expression(this.height>78?"78px":this.width+"px");
}

/*
相容ie ,ff,ie7等瀏覽器做法

*/
max-width: 250px;
max-height: 186px;

width:expression(this.width > 250 ? 250 : true);
height: expression(this.height > 186 ? 186 : true);
   
</style>

</head>

<body>
<img src="/upfile/borough/picture/2010/06/26/20100626010000.jpg"  class="imgsize"/>
<img src="/upfile/borough/picture/2010/07/19/20100719154725.jpg"  class="imgsize"/>

</body>
</html>

 

相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.