Conditional comments

1 Stimme

Conditional comments only work in Internet Explorer, and are thus excellently suited to give special instructions (CSS and JavaScript) meant only for Internet Explorer. They are supported from Internet Explorer 5 onwards.

<!--[if IE]>
This is Internet Explorer
<![endif]-->
<!--[if IE 5]>
This is Internet Explorer 5
<![endif]-->
<!--[if IE 5.0]>
This is Internet Explorer 5.0
<![endif]-->
<!--[if IE 5.5]>
This is Internet Explorer 5.5
<![endif]-->
<!--[if IE 6]>
This is Internet Explorer 6
<![endif]-->
<!--[if IE 7]>
This is Internet Explorer 7
<![endif]-->
<!--[if gte IE 5]>
This is Internet Explorer 5 and up
<![endif]-->
<!--[if lt IE 6]>
This is Internet Explorer lower than 6
<![endif]-->
<!--[if lte IE 5.5]>
This is Internet Explorer lower or equal to 5.5
<![endif]-->
<!--[if gt IE 6]>
This is Internet Explorer greater than 6
<![endif]-->

Note the special syntax:

not-operator (!):
<!--[if !IE 6]-->

greater than:
<!--[if gt IE 6]-->

greater than or equal to:
<!--[if gte IE 6]-->

less than:
<!--[if lt IE 6]-->

less than or equal to:
<!--[if lte IE 6]-->

http://msdn2.microsoft.com/en-us/library/ms537512.aspx