2014-02-28 95 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

相關問題