! Important's hack method in ie7.0 _ CSS/HTML

Source: Internet
Author: User
! Important hack method in ie7.0 due to ie pair! Important identifies bugs, and now most web standard designers use this bug to be compatible with ie and ff. However, ie7.0 fixes this bug, so the problem arises again, how can I be compatible with both ie.7.0 and ie6.0 and ff? As the saying goes, "there are policies and countermeasures", foreign webpage standard designers are compatible with ie7.0, ie6.0, and ff by using css filter (not css hack, the following is my translation from a foreign website.

Create a css style as follows:

# Item {
Width: 200px;
Height: 200px;
Background: red;
}

Create a new p and use the css style defined above:

Some text here



Add the lang attribute in the body representation. The Chinese character is zh:



Now define another style for the p element:

*: Lang (en) # item {
Background: green! Important;
}

This is intended for use! Important overwrites the original css style. Because the lang selector ie7.0 does not support this sentence, it does not have any effect on this sentence, so it achieves the same effect in ie6.0, unfortunately, safari does not support this attribute, so you need to add the following css style:

# Item: empty {
Background: green! Important
}


: The empty selector is a css3 specification. Although safari does not support this specification, this element is still selected, whether or not this element exists, now green will now be available in browsers other than ie, and pass the test in the following browsers and operating systems:

Ie7 beta 2 preview/win
Ie5.01 +/win
Firefox 1.5/win
Opera 8.5/win & linux
Netscape 7.01, 8/win
Mozilla 1.7.12/win & linux
Safari 2/mac
Firefox 1.0.4/linux
Epiphany 1.4.8/linux
Galeon 1.3.20/linux


According to the author, this is actually not a kind of hack, it should belong to the filter, but it does not seem to be the most important, because through this method, we once again solve IE6.0, compatibility between IE7.0 and other browsers, and the use of: lang-filter will be useful in the future.

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.