Article introduction of Wulin.com (www.vevb.com): The comment format of HTML is that IE has made some extensions to HTML comments so that they can support conditional judgment expressions. How to make static HTML code display different content in different IE versions?
The comment format of HTML is that IE has made some extensions to HTML comments to support conditional judgment expressions. How to make static HTML code display different content in different IE versions?
Similar to programming languages, the expressions here also support operators such as greater than (gt), less than (lt), and or non. Conditional annotations are an extension of comments unique to IE5.0 and above versions, which are not supported by other browsers.
[if IE] Determine whether IE is
[if IE 7] Determine whether it is IE7
[if !IE] Determine whether it is not IE
[if lt IE 5.5] Determine whether it is IE5.5 or below. (<)
[if lte IE 6] Determine whether it is equal to IE6 version or below (<=)
[if gt IE 5] Determine whether IE5 or above (> )
[if gte IE 7] Determine whether IE7 version or above
[if !(IE 7)] Determine whether it is not IE7
[if (gt IE 5)&(lt IE 7)] Determine whether it is greater than IE5 and less than IE7
[if (IE 6)|(IE 7)] Determine whether IE6 or IE7
The following is a comprehensive example code for judging the IE version:
<!--[if IE]>You are using Internet Explorer.<![endif]--><!--[if !IE]-->You are not using Internet Explorer.<!--[endif]--><!--[if (IE 7)]>You are not using version 7.<![endif]--><!--[if (IE 7)]>You are using IE 7 or greater.<![endif]--><!--[if (IE 5)]>You are using IE 5 (any version).<![endif]--><!--[if (gte IE 5.5)&(lt IE 7)]>You are using IE 5.5 or IE 6.<![endif]--><!--[if lt IE 5.5]>Please upgrade your version of Internet Explorer.<![endif]-->For <!–[if expression]> HTML <![endif]–>, non-IE browsers will be treated as comments and will not be displayed; for <!–[if expression]–> HTML <!–[endif]–>, non-IE browsers will be displayed as normal code segments.
<!--[if expression]--> HTML <!--[endif]--> <!--[if expression]> HTML <![endif]-->