2009年06月15日 星期一
非IE浏览器:
.post-body img {max-width:400px;}
IE:
.post-body img {
max-width:400px;
width: expression(this.width > 400 ? 400: true);
}
非IE浏览器:
.post-body img {max-width:95%;}
IE:
无法实现百分比的最大值
特别说明:
如果图片放在一个容器中时, 即使设置了容器的max-width值, 也需要设置图片的max-width值, 否则图片还是会撑开容器的尺寸.
#sidebar {width:220px;
width: expression(this.width > 220 ? 220: true);
}
#sidebar img {max-width:200px;
width: expression(this.width > 200 ? 200: true);
}
来源: http://phydeaux3.blogspot.com/2006/01/max-width-and-faking-it-for-ie.html
Posted in 工作, 技术 | Tags: CSS, IE, 样式 | No Comments »
2008年08月29日 星期五
只需要在页面中加入如下HTTP meta-tag:
<meta http-equiv=”X-UA-Compatible” content=”IE=EmulateIE7″ />
只要IE8一读到这个标签,它就会自动启动IE7兼容模式,保证页面完整展示.
还有一种方法是针对整个网站的,在IIS中加入如下描述符就可以有相同的效果,当然这么做范围更广.
<?xml version=”1.0″ encoding=”utf-8″?>
<configuration>
<system.webServer>
<httpProtocol>
<customHeaders>
<add name=”X-UA-Compatible” value=”IE=EmulateIE7″>
</customHeaders>
</httpProtocol>
</system.webServer>
</configuration>
或者你还可以使用IIS admin tool来定义,更为简单.

IIS, IE8, 兼容
PS: 只是权宜之计, 还是尽快符合W3C标准为好.
来源: http://www.cnbeta.com/articles/63391.htm
Posted in 工作, 技术 | Tags: IE, 代码, 兼容性, 网页, 设计 | No Comments »