Conditional comments are an IE-specific rule, and they are not part of any standard. If you check the structure of the conditional comment:
As the name suggests, this is just a big comment <!-- comment --> . IE checks comments for conditions that, again, do not comply with HTML standards.
To create code that doesn't display in IE but does in other browsers, you use the following conditional expression:
This will be rendered by anything but IE.
See how conditions are enclosed in closed comments? That's why this is displayed in regular browsers, while IE checks the conditional expression and decides to skip everything to endif .
EDIT
If you want to add another condition and continue to render the code in browsers other than IE, you can use the following workaround:
<!--[if gt IE 7]> Here is some code for anything but IE 7 and below.
Note. I had to re-open the comment so that IE would not display --> in front of the code. Other browsers will still consider this part of the comment.
zebasz Apr 15 '12 at 5:28 2012-04-15 05:28
source share