针对IE浏览器(兼容)写样式----兼容IE9及以上

<div id="putt" style=" 200px;height: 50px ;border: 1px solid red;">11111</div>
<script language="JavaScript" type="text/javascript">

//判断版本
if(navigator!=null&&navigator!=undefined&&navigator.userAgent!=null&&navigator.userAgent!=undefined){
if(navigator.userAgent.indexOf("MSIE 10.0")>0){
//ie9
alert("你的电脑为IE10")
}else{
alert("你的电脑不为IE10")
}
}
//判断是否为IE
var sfdf=document.getElementById("putt");
if(navigator!=null&&navigator!=undefined&&navigator.userAgent!=null&&navigator.userAgent!=undefined){
if(navigator.userAgent.indexOf('MSIE') >= 0) {
sfdf.style.height="33px";
} else{
sfdf.style.height="63px";
}
}

</script>

原文地址:https://www.cnblogs.com/lihong-123/p/7832072.html