ITeye博客

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

mywebcode · 2011-05-17 14:31 · Markdown

<!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>

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。