Posted 六月 15th, 2009 by o2ho in category
工作,
技术
非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:
Posted 八月 29th, 2008 by o2ho in category
工作,
技术
只需要在页面中加入如下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