Home > Article > Web Front-end > Advantages and Disadvantages of IE's Conditional Comments_HTML/Xhtml_Web Page Production
Conditional comments for IE are a proprietary (and therefore non-standard) Microsoft extension to regular (X) HTML comments.
Conditional comments for IE are a proprietary (and therefore non-standard) Microsoft extension to regular (X) HTML comments. As the name suggests, conditional comments enable you to display blocks of code based on conditions, such as browser version. Although non-standard, conditional comments appear as regular comments to all other browsers and are therefore essentially harmless. Conditional comments first appeared in IE5 on Windows and are supported by all subsequent versions of Windows browsers.
IE’s conditional comments are incredibly effective and easy to remember. The main disadvantage is that these comments need to be placed in the HTML page, not in CSS. In this way, when you don't need these things, or make changes, you will need to maintain a lot of places.
Let’s take a look at a few examples——
Only IE can recognize it
Because only IE5 and above versions begin to support IE conditional comments, all "only IE" means "only IE5 or above" can recognize it.
Only specific versions can be recognized
For example, only IE5 can be recognized, only IE6 can be recognized, only IE7 or IE8 can be recognized. The identification condition is a specific version, which cannot be higher or lower. For example, the following code block will only be valid in IE8
Only those that are not specific versions can recognize
Of course, IE browser needs to be 5 or above version is within the scope of discussion. For example, in the following example, the specific IE7 version cannot be recognized.