Differentiate between IE8 and IE9 's exclusive CSS hack

Source: Internet
Author: User

Generally speaking, when we write a better structure, there is no difference between ie8/9. So few people can focus on CSS hack that only IE8 or IE9 recognize.

Because IE8 and the following version is not supported CSS3, but if we use CSS3, under IE IE9 Normal rendering, but we want to let IE8 and the following browser to achieve the same effect, and do not want to use Css3pie or HTC or conditional comments, and other methods, You may need to use the exclusive CSS hack of IE8 and IE9.

  1. . test{/* 1. */
  2. /* Color: #09F; It used to be IE8/9, and now it supports * /
  3. Color: #09F \0/; /*Used to beIE8 only, now ie9/10 also supports ie9 need to use the following Span style= "FONT-FAMILY:SIMSUN; FONT-SIZE:10.5PT, "lang=" en-US ">rule reset ie9 */
  4. }
  5. @media all and (min-width:0) {/* 2. */
  6. . test{color:red\9;} /* IE9 only, now IE10 also support * /
  7. /* Ps: The Foreigner's method is all , did not consider Opera * *
  8. }
  9. @media screen and (-ms-high-contrast:active), (-ms-high-contrast:none) {/* 3. */
  10. . test {Color:green;}/* ie10+ */
  11. }
  12. : root. Test {color: #963 \9;}/* Previously IE9 only, now 10 is also supported, priority is higher than @media, priority is too high, try to use less */

Note: IE old do not follow the rules, before IE8 only/ie9 only hack, IE10 a appeared all messed up ~

In order to avoid reading this article to the disappointment of the students, the new sort of content (2013-01-28), if there is a mistake to point out.

Now, to write a hack specifically for IE8 or IE9, combine the 1/2/3 species together. If you can, use CSS conditional annotations more reliable.

This hack has been added to the one I wrote in 08 in a browser test written in CSS.

From <http://www.fantxi.com/blog/archives/ie8-ie9-css-hack/>

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.