Css ie6 ie7 firefox compatibility

Source: Internet
Author: User

For example, this condition:
Margin: 3px 3px 0px 3px;
Display: block;

I think you will know what it means at first glance, but through testing, IE6 and IE7 browsers have different performances. IE6 is very loose. It seems that the distance between the left and right of 3 px is changed to double distance, that is, 6 px. IE7 is basically normal.

Later I learned it online and changed the display: block condition to display: inline. Then, IE6 is normal and there is no longer such a large distance and it is more accurate; however, IE7 is abnormal. It seems that the distance on the right is smaller (almost none), and the distance on the left is normal.

After continuing to learn online, I added some conditions and changed the conditions in css to the following:
* Margin: 3px 8px 0px 3px! Important;/*** suitable for IE7.0 ***/
* Margin: 3px 3px 0px 3px;/***** suitable for IE6.0 ***/
Margin: 3px 8px 0px 3px;/***** applicable to FF *****/
* Display: block! Important;
* Display: inline;
Display: block;

Why? The reason is as follows:
IE7.0 is compatible with any conditions. It can recognize both * and! Important;
IE6.0 can recognize *, but cannot recognize it! Important;
FF (Firefox) can recognize it! Important, but cannot recognize.

In this way, if the other party uses FF, it can only recognize margin: 3px 8px 0px 3px, rather than the above two conditions.

If the other party uses IE6.0, the first condition cannot be met. Only the second condition can be recognized first: * margin: 3px 3px 0px 3px;

If the other party uses IE7.0, the first condition is met first. The priority is * margin: 3px 8px 0px 3px! Important;

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.