Resolve IE5/IE5.5/IE6/FF compatibility issues--css_ experience Exchange

Source: Internet
Author: User
Turn from Blue Ideal
Author bias
Original Address http://www.blueidea.com/tech/site/2006/3296.asp
Before looking for a few different versions of the self-running Internet Explorer, just to try to test the compatibility of the page. Don't try not to know, in the IE6 and FF no problem page in IE5 and IE5.5 mess, always heard that IE5 is a Web standard production of a "nail house", now have to believe.

Since there is a problem, then find a solution to the Internet, a search, related articles or a lot of, feel the most direct method or "IE conditional comment", very convenient to the different versions of IE write style. But this will have to write a style for each version, not conducive to file optimization.

Find some relevant CSS hack, think should be able to ie5/ie5.5/ie6/ff hack write together, after testing, finally found a good method, below we see how to achieve:
We all know that using the!important declaration can elevate the application priority of the specified style rule, as in the following example:
-------------------------------------------------

Copy the Code code as follows:

e1{  background-color:red!important;/* Ascension Priority */  background-color:blue;  }

-------------------------------------------------

However, there will be a problem in IE, read my "About CSS style sheet priority" and "about CSS style sheet precedence", you will know that in IE6 and FF with!important declaration can increase the priority, but in IE6!important declaration is not absolute, It is replaced by the property definition of the same name that follows. That is, in the example above, IE6 applies the last value of the background color, which is "blue", while the value of the background color in FF is "red". Based on this, we can split the FF and IE styles.
OK, solve the problems of FF and IE, now to solve the problem of IE itself.
Read the doodle of "bypass IE6 support IE5 of the other kind of writing-ie also support" > "after feeling, use" > "ie whether really can recognize? Let's look at an example:
-------------------------------------------------

e1{  background-color:red;  >background-color:blue;

}
-------------------------------------------------

In the FF is the background color red, and the background color in IE is blue, according to the rules of the style redefined, if the browser can identify ">", you should get the blue background, so you can know that ">" only IE can recognize, this is very important oh! In the back, everyone will know. (Note: I have tested other symbols, such as "~", "'", "

-------------------------------------------------

So you can save a few more bytes? Yes, but hack is not the standard, if abuse hack, it will only be farther away from the standard!


The above is to solve IE5/IE5.5/IE6/FF compatibility issues--css_ experience Exchange content, more relevant content please pay attention to topic.alibabacloud.com (www.php.cn)!

  • 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.