The chaos in the browser market has caused a lot of trouble for designers. After the design page is compatible, the browser must be compatible with that browser. The compatibility between IE6 and FF is easy to solve. It will be troublesome to add IE7, and the emergence of IE8 will be even more troublesome. In the past, the hack IE7 method was useless. What should I do?
Method 1:
Fortunately, Microsoft provides suchCode:
<Meta http-equiv = "X-UA-compatible" content = "Ie = 7"/>
Put this code in
Background: # FFC;/* Valid for Firefox */
* Background: # CCC;/* Valid for IE7 */
_ Background: #000;/* only valid for IE6 */
Let's explain:
Firefox can parse the first paragraph. Firefox cannot recognize the first two because the special symbols "*" and "_" are added. Therefore, it only recognizes Background: # FFC and sees yellow;
IE7 can be recognized in the first two short terms. The last line is used as the standard. Therefore, the last line is Background: # CCC, and the gray line is displayed;
IE6 can recognize all three segments, and "_" can only be recognized by IE6. Therefore, the final resolution is _ Background: #000, and black is displayed.
Amen! It is already the simplest and best-understood method. If you come in with Google, I can tell you responsibly that this method is OK and I have tested it.
I have also tested the code compatible with 7 in IE8. It is okay for IE8 in my current WINDOS 7 test, I don't know whether to use the official IE8 version or not.
PS: If you find that there is still a problem writing by me, check your HTML header to see if the previous content is written in this way.
<! Doctype HTML public "-// W3C // dtd xhtml 1.0 transitional // en" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<HTML xmlns = "http://www.w3.org/1999/xhtml">
This is now a more standard writing method. If you use Dreamweaver as a page, this is also the default specification. Remember, if it is not such a standard writing method, compatibility cannot be guaranteed.
Method 2:
Demanding friends are reluctant to add such a code as <meta http-equiv = "X-UA-compatible" content = "Ie = 7"/> to the page header, because the result is that each page must be added. To be compatible with these browsers, you have to find another method. Earlier in the day, this site released an article "CSS transparent filter for Perfect compatibility with IE6, IE7, IE8 and Firefox", which may be neglected during the test at that time. The compatibility of IE8 is not well solved, many of my friends replied that they couldn't use it. Today, I took some time to read a large amount of data and finally solved the problem.
The following statements are compatible with Internet Explorer 6, Internet Explorer 7, Internet Explorer 8, and Internet Explorer ff. Note that the order below cannot be reversed.
Margin-bottom: 40px;/* FF attributes */
Margin-bottom: 140px \ 9;/* attributes of IE6/7/8 */
Color: Red \ 0;/* IE8 supported */
* Margin-bottom: pixel PX;/* attributes of IE6/7 */
The following is an example. You can run the code to check the effect.
<! Doctype HTML public "-// W3C // dtd xhtml 1.0 transitional // en" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<HTML xmlns = "http://www.w3.org/1999/xhtml">
<Head>
<Meta http-equiv = "Content-Type" content = "text/html; charset = UTF-8"/>
<Title> 2010 the latest version is fully compatible with CSS hack writing in IE6, IE7, IE8, and FF --www.aa25.cn. </title>
<Style type = "text/CSS">
# ABC {
Border: 2px solid # 00f;/* FF attribute */
Border: 2px solid #090 \ 9;/* attributes of IE6/7/8 */
Border: 2px solid # f90 \ 0;/* IE8 support */
_ Border: 2px solid # f00;/* attributes of IE6 */
}
/* The upper and lower order cannot be entered incorrectly */
</Style>
</Head>
<Body>
<Div id = "ABC">
<Ul>
<Li> FF bottom blue edge </LI>
<Li> Red Edge in IE6 </LI>
<Li> IE7 green edge </LI>
<Li> IE8 lower Yellow edge </LI>
<Li> reprinted please indicate the path to source standards <a href = "http://www.68css.com % 22% 3ewww.68css.com % 3C/A % 3E % 3C/LI>
</Ul>
</Div>
</Body>
</Html>