Although the conditional comments of IE browser are not commonly used, they are extremely powerful and can be used to differentiate the version of IE browser.
<! -- [If IE]> only ie <! [Endif] -->
All ie identifiable
<! -- [If IE 5.0]> only IE 5.0 <! [Endif] -->
Only ie5.0 can recognize
<! -- [If gt ie 5.0]> only IE 5.0 + <! [Endif] -->
Higher than ie5.0 can be identified
<! -- [If lt IE 6]> only IE 6-<! [Endif] -->
Less than IE6 recognizable
<! -- [If gte ie 6]> only IE 6/+ <! [Endif] -->
Both IE6 and IE6 can be identified.
<! -- [If lte ie 7]> only IE 7/-<! [Endif] -->
Versions earlier than IE7 and IE7 are recognizable
LTE: Short for less than or equal to, that is, less than or equal.
LT: Short for less than, that is, less.
GTE: Short for greater than or equal to, that is, greater than or equal.
GT: Short for greater than, that is, greater.
! : It means not equal to, which is the same as the non-equal identifier in JavaScript.
Only the <! -- [If! IE]> not ie <! [Endif] --> is that okay?
If you think so, it will be wrong, because non-ie does not recognize the IE conditional comments, so it is all comments directly,
OK. Let's take a look at the correct method.
<! -- [If! IE]> < -->
Only Internet Explorer can see this
<! [Endif] -- > I was going to add some content here, which can only be seen by non-ie and encoded by the editor. ^ _ ^. Try it now. Only non-ie can see it,
The key is the header after the condition annotation <-> It is treated as an internal comment in IE, and the comment is closed in a non-IE browser. To distinguish non-ie browsers, which are generally used <! ->.
From: http://blog.silentash.com/2010/03/conditional-comments-for-ie-and-non-ie-browsers/
More:
1 <! -- [If lt IE 7]> <HTML class = "ie IE6"> <! [Endif] -- >
2 <! -- [If IE 7]> <HTML class = "ie IE7"> <! [Endif] -- >
3 <! -- [If IE 8]> <HTML class = "IE8"> <! [Endif] -- >
4 <! -- [If IE 9]> <HTML class = "ie9"> <! [Endif] -- >
5 <! -- [If (GT ie 9) |! (IE)]> <! -- > < Html > <! -- <! [Endif] -- >
6