The browsers of different IE versions have different interpretations of the WEB standard pages we have created. Specifically, they have different interpretations of CSS. To be compatible with these, we can use conditional annotations for their respective definitions, to achieve compatibility. If you are interested in using block annotations, refer to the common annotations in html below: In this example, XXXXXXXX is the annotation content.
Block comment css in html ( Both Internet Explorer and Internet Explorer can be recognized.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
Ite: less than or equal to means less than or equal to IE6 browser. It is used for condition comments of IE browser and is often used for CSShack and JS for IE.
In the process of learning and applying standard WEB pages, the compatibility of WEB pages with browsers is a common problem. Among them, Microsoft Internet Explorer (IE) occupies more than half of the browser market, in addition to Firefox and Opera. These browsers must be compatible.
At the same time, for IE alone, due to the replacement of the IE version, viewers currently use IE5 (IE5.5), IE6, and IE7. The three versions display different interpretations of the standard WEB page (XHTML + CSS. In addition, other non-IE browsers and IE have different interpretations of some CSS. Therefore, you can use the proprietary condition annotations in IE browser to define relevant attributes.
Condition annotations can only be used for Explorer 5 + Windows (IE) (condition annotations are supported from IE5 ). If you have installed Multiple IE, the Conditional comments will be based on IE of the highest version (IE 7 is currently used ).
Conditional annotations can only be used in windows Internet Explorer (IE). Therefore, you can add special commands for IE by using conditional annotations.
In layman's terms, condition comments are some if judgments, but these judgments are not executed in scripts, but directly executed in html code, such:
1. Basic Structure of the conditional annotation and the HTML annotation ( ) Is the same. Therefore, browsers other than IE will regard them as common comments and ignore them completely.
2. IE will determine whether to parse the content in the condition comment just like the normal page content based on the if condition.
3. Conditional annotations use the HTML annotation structure. Therefore, they can only be used in HTML files, not CSS files.
You can use the following code to check the current version of IE (Note: it is ineffective in non-ie browsers)
The Code is as follows:
If the current browser is IE but the version is lower than IE5, what should I do?
This differentiates the implementation of CSS by IE7 and IE6 to achieve compatibility. At the same time, the first line of CSS is compatible with other non-ie browsers.
Note: The default CSS style should be located at the first line of the HTML document. All the content for condition annotation judgment must be located after the default style.
For example, if the following code is executed in IE, it is displayed in red, but not in IE. If the condition annotation judgment is placed on the first line, it cannot be implemented. This example shows how to solve the compatibility problem between the web browser and the Internet Explorer.
The Code is as follows:
At the same time, someone will try to use