Detailed description of hack in css ie ff

Source: Internet
Author: User
Tags html header valid

Method 1:

Fortunately, Microsoft provides the following code:

<Meta http-equiv = "x-ua-compatible" content = "ie = 7"/>

Put this code in it, and parse the page in ie8 exactly the same as ie7. Therefore, you can basically ignore ie8. The rest of the code only needs to be written in this way.

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 Tutorial: If you find that there is still a problem writing by me, please check your html header to see if the previous content is written in such a standard 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 do not want to add such a code in the page header, because the result is that every page has to be added. To be compatible with these browsers, you have to find another method. Earlier in the day, this site released an article "transparent filter for css tutorials compatible with ie6, ie7, ie8 and firefox", which may be neglected during the test at that time. The compatibility of ie8 was 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: 140px9;/* attributes of ie6/7/8 */

Color: red;/* ie8 supported */

* Margin-bottom: Pixel px;/* attributes of ie6/7 */

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.