Skip to content

Instantly share code, notes, and snippets.

@vedranjaic
Created May 26, 2013 17:37
Show Gist options
  • Save vedranjaic/5653462 to your computer and use it in GitHub Desktop.
Save vedranjaic/5653462 to your computer and use it in GitHub Desktop.
html: If IE & IE Mobile Conditional Statement
<!--
Operator Description
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
-->
<!--[if (lt IE 9) & (!IEMobile)]>
...
<![endif]-->
---
<!--[if IE 7 ]>
<p>Only IE 7 will see this</p>
<![endif]-->
---
<!--[if lt IE 7 ]>
<p>Only less than IE 7 will see this</p>
<![endif]-->
---
<!--[if gte IE 6 ]>
<p>Only IE 6 and greater will see this</p>
<![endif]-->
---
<!--[if IE 5]>
<p>This covers all versions of IE5 including IE5.5</p>
<![endif]-->
---
<!--[if !IE 6]>
<p>IE7 or IE5 only</p>
<![endif]-->
---
<!--[if (IE 6)|(IE 7)]>
<p>IE6 or IE7 only </p>
<![endif]-->
---
In downlevel-revealed conditional comments, the HTML content inside the conditional statements is revealed to browsers that don’t support conditional comments, because the conditional statements—and only the conditional statements—are ignored. If the statement evaluates to true (in a supporting browser), the content inside the conditional statements is also revealed.
<!--[if !IE]>-->
<p>This is shown in downlevel browsers.</p>
<!--<![endif]-->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment