Conditional Comments

With conditional comments you are able to show content to Internet Explorer users only. You can even target different versions. Conditional comments is a way to fix bugs that only appear in IE.

Some examples:

<!--[if IE]>
	Only visible for IE users
<![endif]-->

<![if !IE]>
	Only visible for non-IE users
<![endif]>

<!--[if IE 7]>
	Only visible in IE7
<![endif]-->

<!--[if (gte IE 7)&(lte IE 8)]>
	Only visible from IE7 to IE8
<![endif]-->

<!--[if lt IE 7]>
	Only visible in IE7 or lower
<![endif]-->

Options

  • lt Less than
  • lte Less than or equal to
  • gt Greater than
  • gte Greater than or equal to
  • ! Not

More on Conditional comments on MSDN