In the use of Div + CSS webpage layout, CSS compatibility issues have been plaguing everyone. Before browser compatibility is resolved, comrades still need to work hard;
The solution to compatibility between ie6.0 and Firefox is relatively easy, but later IE7 emerged, and later Microsoft released IE8. The original hack methods of IE6 and IE7 were no longer available. What should I do?
Now that the problem has occurred, we need to find a solution: This article is from www.51css.net.
Method 1:This article is from www.51css.net.
Microsoft provides the following code: This article is from www.51css.net.
- <Meta http-equiv = "X-UA-compatible" content = "Ie = emulateie7"/>
This article is from www.51css.net.
Put this code in the
|
_ Background: #000;/* only valid for IE6 */
* Background: # CCC;/* Valid for IE7 */
Background: # FFC;/* Valid for Firefox */ This article is from www.51css.net. |
Note:
This article is from www.51css.net.
IE6 can recognize three segments, but "_" can only be recognized by IE6;
This article is from www.51css.net.
IE7 can recognize "_" and "*".
This article is from www.51css.net.
Firefox cannot recognize any CSS style with "_" and "*". This article is from www.51css.net.
IE8 does not include any code compatible with 7 in the webpage header. After testing, IE8 in ipvs 7 is okay, I don't know whether to use the official IE8 version or not. This article is from www.51css.net.
Tip: If you still find a problem, check the header of your HTML page to see if the previous content is written in this way. This article is from www.51css.net.
- <! Doctype HTML public "-// W3C // dtd xhtml 1.0 transitional // en"
- Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd>
- <HTML xmlns = "http://www.w3.org/1999/xhtml">
This article is from www.51css.net.
This is a more standard writing method. If you use Dreamweaver as a page, this is also the default specification. Remember, if you do not use this standard writing method, compatibility cannot guarantee that this article comes from www.51css.net
Method 2:This article is from www.51css.net.
Many of my friends do not want to add such a code in the header of the page as <meta http-equiv = "X-UA-compatible" content = "Ie = 7"/>, this requires that each page be added. Next we will introduce a method compatible with IE6/IE7/IE8/ff. Note that the following sequence cannot be reversed:
This article is from www.51css.net.
- Margin-bottom: 40px;/* FF attributes */
- Margin-bottom: 140px \ 9;/* attributes of IE6/7/8 */
- Color: Red \ 0;/* IE8 supported */
- * Margin-bottom: pixel PX;/* attributes of IE6/7 */