您的位置: 首页 > 源码资料
css实现图片自动按比例缩放,兼容IE6 7 8,火狐等
源码资料 时间:2013-05-16 作者/发布人:科杰在线 点击:2840
纯css的防止图片撑破页面的代码,图片会自动按比例缩小。(css 图片自动缩放 )
完美兼容:IE6、IE7、IE8、Firefox
<!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>科杰在线pc354.com</title>
<style type="text/css">
.content-width {MARGIN: auto;WIDTH: 700px;}
.content-width img{MAX-WIDTH: 100%!important;HEIGHT: auto!important;width:expression(this.width > 600 ? "600px" : this.width)!important;}
</style>
</head>
<body>
<div class="content-width">
<p><img src="pc354.jpg"/></p>
<p><img src="pc354.jpg"/></p>
</div>
</body>
</html>
完美兼容:IE6、IE7、IE8、Firefox
<!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>科杰在线pc354.com</title>
<style type="text/css">
.content-width {MARGIN: auto;WIDTH: 700px;}
.content-width img{MAX-WIDTH: 100%!important;HEIGHT: auto!important;width:expression(this.width > 600 ? "600px" : this.width)!important;}
</style>
</head>
<body>
<div class="content-width">
<p><img src="pc354.jpg"/></p>
<p><img src="pc354.jpg"/></p>
</div>
</body>
</html>
--------------------------全文完----------------------------
0% (0)
0% (0)