`
mywebcode
  • 浏览: 987967 次
文章分类
社区版块
存档分类
最新评论

CSS样式如何控超过页面宽度的图片正比例缩放

 
阅读更多

<!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>无标题文档</title>

<style>

p {
margin:auto;
width:950px;
}
p img{max-width: 100% !important; height: auto!important; width:expression(this.width > 950 ? "950px" : this.width)!important;}
</style>

</head>

<body>

<p>

<img src="http://www.tianshui.com.cn/Files195/BeyondPic/2008-1/30/Img254961375.jpg" width="1024px;;" />

</p>

</body>
</html>

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics