I was pondering this question last night while debugging some things in IE7, when I typed in <!--[if IE7]>...
it occured to me that I've seen <!--[if !IE]>
.
Now what get me is that as far as I understand it, only IE recognises these conditional comments, so to to say if NOT IE
makes no sense, does IE see this and say "Iam IE, so this doesn't apply to me?" or are people getting confused with which browsers can recognise it?
So my question is.
Where would you use <!--[if !IE]>
and what is its purpose?
AFAIK, other browsers treat conditional comments as comment blocks (ie, they aren't parsed at all). So, such a comment will make something happen (ie, include a CSS file) in anything EXCEPT Internet Explorer (so it's the inverse of the
[if IE]
conditional comments). Add all your CSS in such comments and see how IE behaves :P.[EDIT]
OK, I just checked. This is indeed silly. Since the
<style>
tag is in the CC, other browsers don't parse it at all, so it effectively doesn't get included at all. IE indeed interprets this as "aha, I am IE so I need to skip this". The only reasonable explanation I can think of is Microsoft assuming at some point other browsers might start parsing conditional comments.