IE条件注释

来自https://www.jianshu.com/p/11d94c446fa3

可使用如下代码检测当前IE浏览器的版本(注意:在非IE浏览器中是看不到效果的)

1
2
3
4
5
6
7
8
9
10
11
12
<!––[if IE]>
<h1>您正在使用IE浏览器</h1> <!––[if IE 5]>
<h2>版本 5</h2> <![endif]––>
<!––[if IE 5.0]>
<h2>版本 5.0</h2> <![endif]––>
<!––[if IE 5.5]>
<h2>版本 5.5</h2> <![endif]––>
<!––[if IE 6]>
<h2>版本 6</h2> <![endif]––>
<!––[if IE 7]>
<h2>版本 7</h2> <![endif]––>
<![endif]––>

lte:就是Less than or equal to的简写,也就是小于或等于的意思。 lt :就是Less than的简写,也就是小于的意思。 gte:就是Greater than or equal to的简写,也就是大于或等于的意思。 gt :就是Greater than的简写,也就是大于的意思。 ! : 就是不等于的意思,跟javascript里的不等于判断符相同。