CSS Hack solves Browser Compatibility issues

Source: Internet
Author: User

One of the biggest challenges encountered in web design is the compatibility of web pages with different browsers, because mainstream browsers such as IE 6.0, IE 7.0, firefox 2, and Opera 9 do not parse CSS very closely, this results in different Page effects. So what method can be used to effectively solve the problem of different Page effects in different browsers? The widely used method is CSS Hack, which defines the design style of displaying webpages in different browsers using special CSS, and writes different CSS for different browsers to maximize compatibility with browsers.

In general, I will consider both IE 6.0/IE 7.0/firefox 2.0 browsers. The following is a frequently used CSS Hack technique:

1. The most widely used is! Important. It can be understood correctly for IE (IE 7.0! Important) set different styles for non-IE browsers, as long as they are added after the style for non-IE browsers! Important, you can give priority to it. So I will use it to balance the differences between IE 6.0 and Firefox! Important.

2. * + html {...} This HACK can be used only for IE7 styles.

3. if condition Hack of IE

<! -- [If IE]> Only IE <! [Endif] --> All IE identifiable

<! -- [If IE 5.0]> Only IE 5.0 <! [Endif] --> only IE5.0 can recognize

<! -- [If gt IE 5.0]> Only IE 5.0 + <! [Endif] --> IE5.0 for IE5.5 can be identified

<! -- [If lt IE 6]> Only IE 6-<! [Endif] --> only IE6 can recognize

<! -- [If gte IE 6]> Only IE 6/+ <! [Endif] --> IE6 and IE5.x lower than IE6 can be recognized

<! -- [If lte IE 7]> Only IE 7/-<! [Endif] --> only IE7 can recognize

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.