IE Statements

Amplify Logo ImageAmplify provide web and digital media solutions.

Amplify offer a diverse range of services for business wanting to succeed online, and take a primary focus on consultancy, development and support for e-Commerce, e-Learning and Joomla! Content Management System projects... ...
we just mention these in particular, because we cannot fit in this space all of the other things we can help with!

Conditional statements are a proprietary Microsoft extension to Internet Explorer that provides a mechanism to target each of the versions of IE browsers either specifically, or as a group. This extension was introduced in IE5, so it can only be used in documents rendered in browsers from IE5 up on the Windows platform.

The basic form of conditional comments is as follows:

<!--[if IE ]>
<link href="/iecss.css" rel="stylesheet" type="text/css">
<![endif]-->

The basic structure is the same as an HTML comment (). Therefore all other browsers will see them as normal comments and will ignore them entirely. The trick is to use these statements to isolate certain CSS for the browsers you need to.

Conditional Comment Operators

IE - represents Internet Explorer; if a number value is also specified, it represents a version vector
lt - less than operator
lte - less than or equal to
gt - greater than
gte - greater than or equal to
! - the NOT operator
() - subexpression operator
& - the AND operator
| - the OR operator
true - evaluates to true
false - evaluates to false

For example, you would use the following statement to target IE version 7:

<!--[if IE 7 ]>
Only IE 7 will see this
<![endif]-->

Below are some common statements you can use

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