How to let static HTML code display different content according to different IE versions. The trick here is to take advantage of IE's HTML comment expression.
The HTML annotation format is <!--Comment Content--IE has extended some HTML annotations to support conditional judgment expressions:
<!--[if expression]> HTML <! [endif]--> Displays HTML content when the expression is true.
Example:
View Plaincopy to Clipboardprint?
<!--[if IE 5]>
<p>welcome to Internet Explorer 5.</p>
<! [endif]-->
<!--[if IE 5]>
<p>welcome to Internet Explorer 5.</p>
<! [endif]-->
Like the programming language, the expressions here also support greater than (GT), less than (LT), and or non-equal operators. Here are some examples.
[If IE] determine if IE
[If IE 7] determine if it is IE7
[If! IE] to determine whether it is not ie
[If Lt IE 5.5] determine if it is IE5.5 the following version. (<)
[If LTE IE 6] Determine if it is equal to the IE6 version or the following (<=)
[If GT IE 5] To determine whether IE5 above version (>)
[If GTE IE 7] determine if IE7 version or above
[If! (IE 7)] Judging if it's not IE7
[If (GT IE 5) & (LT IE 7)] determine if it is greater than IE5, less than IE7
[If (IE 6) | (IE 7)] Judging whether IE6 or IE7
code example:
View Plaincopy to Clipboardprint?
<!--[if ie]><p>you are using the Internet explorer.</p><! [endif]-->
<! [If! Ie]><p>you is not using the Internet explorer.</p><! [endif]>
<!--[if IE 7]><p>welcome to Internet Explorer 7!</p><! [endif]-->
<!--[if! ( IE 7)]><p>you is not using version 7.</p><! [endif]-->
<!--[if GTE ie 7]><p>you is using IE 7 or greater.</p><! [endif]-->
<!--[if (ie 5)]><p>you is using IE 5 (any version). </p><! [endif]-->
<!--[if (GTE IE 5.5) & (LT IE 7)]><p>you is using IE 5.5 or IE 6.</p><! [endif]-->
<!--[if LT IE 5.5]><p>please upgrade your version of the Internet explorer.</p><! [endif]-->
<!--[if ie]><p>you are using the Internet explorer.</p><! [endif]-->
<! [If! Ie]><p>you is not using the Internet explorer.</p><! [endif]>
<!--[if IE 7]><p>welcome to Internet Explorer 7!</p><! [endif]-->
<!--[if! ( IE 7)]><p>you is not using version 7.</p><! [endif]-->
<!--[if GTE ie 7]><p>you is using IE 7 or greater.</p><! [endif]-->
<!--[if (ie 5)]><p>you is using IE 5 (any version). </p><! [endif]-->
<!--[if (GTE IE 5.5) & (LT IE 7)]><p>you is using IE 5.5 or IE 6.</p><! [endif]-->
<!--[if LT IE 5.5]><p>please upgrade your version of the Internet explorer.</p><! [endif]-->
Note: This annotation extension is not supported in versions below IE5. But it's hard to find IE4 now ...:)
Determine the version of IE browser in HTML