Conditional annotation for IE is a proprietary (and therefore non-standard) Miscrosoft extension for regular (X) HTML annotations.
Conditional annotation for IE is a proprietary (and therefore non-standard) Miscrosoft extension for regular (X) HTML annotations. As the name implies, conditional comments allow you to display code blocks based on conditions (such as browser version). Although non-standard, conditional annotations appear as regular annotations for all other browsers and are therefore essentially harmless. Conditional annotations first appeared in IE5 on Windows and are supported by all subsequent versions of the Widnows browser.
Conditional annotations for IE are very effective and very easy to remember. The main disadvantage is that these comments need to be placed in the HTML page, not in the CSS. In this way, when you don’t need these things or make changes, you need to maintain a lot of places.
Let's take a look based on a few examples-
Only IE can recognize itBecause only IE5 or above versions start to support IE conditional annotation, all IE can recognize means that only IE5 or above versions can recognize.
Only a specific version can be recognizedFor example, only IE5 can recognize, only IE6 can recognize, and only IE7 or IE8 can recognize. The recognition conditions are specific versions, and they cannot be high or low. For example, the following code block will only be valid in IE8
<!--[if IE 8]>
<style type=text/css>
@import test.css;
</style>
<![endif]-->
Only those not specific versions can be identifiedOf course, IE browser needs to be version 5 or above before it is within the scope of discussion. For example, in the following example, the specific IE7 version cannot be recognized.
<!--[if !IE 7]>
<style type=text/css>
@import test.css;
</style>
<![endif]-->
Previous page 1 2 3 Next page Read the full text