Marius van Witzenburg "Learned my lesson in life, now setting my action to stay in life."

29Mar/100

Conditional comments for Microsoft Internet Explorer

Conditional comments only work in Explorer on Windows, and are thus excellently suited to give special instructions meant only for Explorer on Windows. They are supported from Explorer 5 onwards, and it is even possible to distinguish between IE5.0, IE5.5, IE6.0, IE7.0 and IE8.0.

My opinion, lose Internet Explorer ;-)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<!--[if IE]>
According to the conditional comment this is Internet Explorer<br />
<![endif]-->
 
<!--[if IE 5]>
According to the conditional comment this is Internet Explorer 5<br />
<![endif]-->
 
<!--[if IE 5.0]>
According to the conditional comment this is Internet Explorer 5.0<br />
<![endif]-->
 
<!--[if IE 5.5]>
According to the conditional comment this is Internet Explorer 5.5<br />
<![endif]-->
 
<!--[if IE 6]>
According to the conditional comment this is Internet Explorer 6<br />
<![endif]-->
 
<!--[if IE 7]>
According to the conditional comment this is Internet Explorer 7<br />
<![endif]-->
 
<!--[if gte IE 5]>
According to the conditional comment this is Internet Explorer 5 and up<br />
<![endif]-->
 
<!--[if lt IE 6]>
According to the conditional comment this is Internet Explorer lower than 6<br />
<![endif]-->
 
<!--[if lte IE 5.5]>
According to the conditional comment this is Internet Explorer lower or equal to 5.5<br />
<![endif]-->
 
<!--[if gt IE 6]>
According to the conditional comment this is Internet Explorer greater than 6<br />
<![endif]-->

Note the special syntax:

! The "not" operator.
lt The "less than" operator.
lte The "less than or equal to" operator.
gt The "greater than" operator.
gte The "greater than or equal to" operator

I hope you will be able to fix things more easy with Internet Fucking Explorer :-P