Forum Moderators: open
The trick is fairly simple. Everyone who's used IE Conditional Statements is familiar with the concept:
<!--[if gte IE 5.5000]>
<p>Only IE version 5.5 and up will render this paragraph.</p>
<![endif]-->
However, what if we only wanted to hide that paragraph from IE version 5.0 and below, while still allowing non-IE browsers to render the paragraph? The trick is to simply fool the other browsers into thinking the conditional statement has been ended, before you get to the content of the conditional:
<!--[if gte IE 5.5000]><!-->
<p>All browsers except IE versions lower than 5.5 will render this paragraph.</p>
<![endif]-->
By adding the
<!--> right after opening the conditional statement, non-IE browsers think the comment has been finished. They then render the comment's content as usual. The close of the comment is not rendered by other browsers because it is between the < > symbols. IE will treat the whole thing like a normal conditional statement. As far as I can tell, this is a great way to hide problematic code from the lower versions of IE, while still allowing other browsers to render it.
<!--[if! IE 6]>
The contents of that conditional comment will be read by all versions of IE, as long as they're not version 6. By simply leaving off a version number, this principle can be used to cause all versions of IE to ignore the contents of the comment:
<!--[if! IE]><!-->This will show to everyone except Internet Explorer users.<![endif]-->
Obviously this technique should be used sparingly, but I can see certain applications where it would be quite handy.