Solutions to CSS style compatibility problems

Source: Internet
Author: User

I have a good understanding of CSS styles for web development, so that all browsers can correctly parse webpages. Today, let's talk about padding first.

When creating a webpage, it is displayed normally under IE7, and some hack methods are basically solved in IE6, that is, there is still a problem in IE8 and Firefox, And the compatibility problem is really broken down.

 

Assume that a padding value is set, which is different in FF, IE8, and IE6.

The first consideration is the FF value.

. Test {padding: 10px}

Then consider the value in IE8.

. Test {padding: 10px; * padding: 9px}

Finally, consider the value in IE6.

. Test {padding: 10px; * padding: 9px; _ padding: 8px}

In this way, you can. For compatibility, we should first consider ff and opera browsers, and finally consider ie6. In the preceding example, both IE8 and IE6 can recognize *, but FF cannot. Therefore, use * as the hack of IE8, but _ is not recognized in ff and IE8, and only IE6 can recognize it. Therefore, use _ as the hack of IE6.

After <meta http-equiv = "X-UA-compatible" content = "Ie = emulateie7"/> is added to the other two pages, IE8 is displayed as normal, it is still an old problem to add this sentence on the third-level page. There is a lot of gap between the layer and the layer.

For details, see your CSS and HTML.Code.

Add <meta http-equiv = "X-UA-compatible" content = "Ie = 7"/> or <meta http-equiv = "X-UA-compatible" content = "Ie = emulateie7"/> tells IE8 to use IE7 compatibility mode for page resolution. If your CSS definition has problems, simply adding this will not solve the problem.

 

From: http://www.laoy8.cn/Html? 456777. html

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.