2014-02-28 52 views

回答

2

可以使用条件注释来检测IE版本

<!--[if lt IE 7 ]> <html class="ie6"> <![endif]--> 
<!--[if IE 7 ]> <html class="ie7"> <![endif]--> 
<!--[if IE 8 ]> <html class="ie8"> <![endif]--> 
<!--[if IE 9 ]> <html class="ie9"> <![endif]--> 
<!--[if (gt IE 9)|!(IE)]><!--> <html class=""> <!--<![endif]--> 

例如你可以把任何内容放在这个评论内,它只会显示浏览器低于IE 9

<!--[if lt IE 9 ]> <script src="doOldIEstuff.js"></script> <![endif]--> 
+0

我可以把条件注释放在body标签中吗? – Adrian

+0

@Adrian是的,你可以把它们放在任何地方。 – Mathias

相关问题