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