<!--[if IE]> Only IE <![endif]--> 所有的IE可識(shí)別 <!--[if IE 5.0]> Only IE 5.0 <![endif]--> 只有IE5.0可以識(shí)別 <!--[if gt IE 5.0]> Only IE 5.0+ <![endif]--> 高于IE5.0都可以識(shí)別 <!--[if lt IE 6]> Only IE 6- <![endif]--> 低于IE6可識(shí)別 <!--[if gte IE 6]> Only IE 6/+ <![endif]--> IE6以及IE6以上都可識(shí)別 <!--[if lte IE 7]> Only IE 7/- <![endif]--> IE7及ie7以下版本可識(shí)別
lte:就是Less than or equal to的簡寫,也就是小于或等于的意思。 lt :就是Less than的簡寫,也就是小于的意思。 gte:就是Greater than or equal to的簡寫,也就是大于或等于的意思。 gt :就是Greater than的簡寫,也就是大于的意思。 ! :就是不等于的意思,跟javascript里的不等于判斷符相同
看到這里只可能會(huì)覺得<!--[if !IE]> not IE<![endif]-->這樣不就可以了嗎? 如果你這樣想就錯(cuò)了,因?yàn)榉莍e根本不會(huì)識(shí)別ie的條件注釋,所以就直接全部是注釋了, ok,來看看正確的寫法吧