04 IE 兼容性
通用
IE if
<!--[if IE 5]> 仅IE5.0与IE5.5可以识别 <![endif]-->
<!--[if gt IE 5.0]> IE5.0以及IE5.0以上版本都可以识别 <![endif]-->
<!--[if IE 6]> 仅IE6可识别 <![endif]-->
<!--[if lt IE 6]> IE6以及IE6以下版本可识别 <![endif]-->
<!--[if gte IE 6]> IE6以及IE6以上版本可识别 <![endif]-->
<!--[if IE 7]> 仅IE7可识别 <![endif]-->
<!--[if lt IE 7]> IE7以及IE7以下版本可识别 <![endif]-->
<!--[if gte IE 7]> IE7以及IE7以上版本可识别 <![endif]-->隐藏 input 框的清除按钮
#textFieldId::-ms-clear {display: none;}
input[type=text]::-ms-clear { display: none; }判断 IE8 以下
var DEFAULT_VERSION = 8.0;
var ua = navigator.userAgent.toLowerCase();
var isIE = ua.indexOf('msie') > -1;
var safariVersion;
if (isIE) {
safariVersion = ua.match(/msie ([\d.]+)/)[1];
}
if (safariVersion <= DEFAULT_VERSION) {
// ie8
}IE 不支持 classList
ajax 不支持 formData
IE8 兼容性问题
某些标签无法使用。如nav、section、footer
制作响应式网站时,先制作桌面版网站,再来制作手机版。
可以使用 PIE.htc 解决 box-radius、线性渐变 ( linear-gradient)、rgba、box-shadow、border-image的兼容性问题,但是要看服务器是否支持 htc 的文件格式,否则部署到服务器之后不可用。
无法使用的css样式(部分):
无法使用的js方法(部分):
IE9兼容性问题
使用透明颜色时,必须使用 rgba(0,0,0,.5) ,不要使用 rgb(0,0,0,.5)
使用 console.log() 时,必须先判断 if(window.console){...},不然可能会阻塞代码运行。
使用 transform 属性时,加上 -ms- 的前缀。
最后更新于
这有帮助吗?