CSS hack compatible with Ie6/ie7/ie8/firefox

Source: Internet
Author: User

. color{  Background-color: #CC00FF;  Background-color: #FF00009;  *background-color: #0066FF;  _background-color: #009933; }

* * Remember that the above style is interpreted as the order is FF, IE8, IE7, IE6 * * Display results: Browse with Firefox, color is purple with IE8 browse, color is red with IE7 browse, color is blue with IE6 browse, color is green

IE8 Latest CSS hack: "" Example: "margin:0px auto;". Here the "" can distinguish all IE and Firefox. "9" Example: "margin:0px auto9;". Here the "9" can distinguish all IE and Firefox. "*" IE6, IE7 can be identified. IE8, Firefox cannot. "_" IE6 can Identify "_", IE7, IE8, Firefox cannot.

Some IE6 IE7 IE8 ff CSS hack

P{+color: #f00;} support IE6 IE7 does not support FF Ie8p{_color: #f00;} support IE6 not supported Ffp{color: #00f!important;} P{color: #f00;} support IE7 IE6 ff Ie8p{color: #00f!important;color: #f00;} support IE7 IE8 FF does not support Ie6head:first-child+body P{color: #f 00;} Support IE7 IE8 FF does not support IE6

CSS hack compatibility table for each browser:

IE6 IE7 IE8 Firefox Chrome Safari
!important Y Y
_ Y
* Y Y
*+ Y
9 Y Y Y
Y
Nth-of-type (1) Y Y

Tip: What is CSS hack?   Because of different browsers, such as IE6, IE7, IE8, Firefox, and so on, the parsing of CSS is not the same, so it will result in the resulting page effect is not the same, not get the page effect we need.   At this time we need to write different CSS for different browsers, so that it can be compatible with different browsers, can be in different browsers can also get the desired page effect. The process of writing different CSS code for different browsers is called CSS hack, also called CSS hack.

CSS hack compatible with Ie6/ie7/ie8/firefox

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.